Okay, I'll admit my SQL skill are pre-newbie, but I'm kinda at a loss.
I'm trying to build some reports, and I am begging for some direction. The following query works, but I need to add more columns... SELECT "party_group"."group_name" AS "Company_Name" max("party_classification"."party_classification_group_id") as "Discount Type", sum("order_item"."unit_price")as "Discounted Amount", sum("order_item"."unit_list_price")as "Retail Amount", count( distinct "order_header"."order_id")as "Number Of Orders" FROM "party" INNER JOIN "party_classification" ON "party"."party_id" = "party_classification"."party_id" INNER JOIN "order_header" ON "party"."party_id" = "order_header"."bill_to_party_id" INNER JOIN "party_group" ON "party"."party_id" = "party_group"."party_id" INNER JOIN "order_item" ON "order_header"."order_id" = "order_item"."order_id" WHERE party_classification_group_id LIKE 'DEALER%' AND "order_item"."status_id" = 'ITEM_COMPLETED' GROUP BY "party_group"."group_name" ORDER BY "party_group"."group_name" ASC I need to add in columns like phone numbers and primary contact names, city states, etc... So I guess I need subqueries or some sort of SQL pixie dust, cause I can't figure out how to query in two different directions (order info and customer info). Help. Anyone got any example SQL scripts around? Or links to examples that emulate the ofbiz database layout? -- Walter |
Maybe try to create SQL views that mimic the OFBiz view entities.
Walter Vaughan wrote: > Okay, I'll admit my SQL skill are pre-newbie, but I'm kinda at a loss. > > I'm trying to build some reports, and I am begging for some direction. > The following query works, but I need to add more columns... > > SELECT > "party_group"."group_name" AS "Company_Name" > max("party_classification"."party_classification_group_id") as > "Discount Type", > sum("order_item"."unit_price")as "Discounted Amount", > sum("order_item"."unit_list_price")as "Retail Amount", > count( distinct "order_header"."order_id")as "Number Of Orders" > FROM > "party" INNER JOIN "party_classification" ON "party"."party_id" = > "party_classification"."party_id" > INNER JOIN "order_header" ON "party"."party_id" = > "order_header"."bill_to_party_id" > INNER JOIN "party_group" ON "party"."party_id" = > "party_group"."party_id" > INNER JOIN "order_item" ON "order_header"."order_id" = > "order_item"."order_id" > WHERE > party_classification_group_id LIKE 'DEALER%' > AND "order_item"."status_id" = 'ITEM_COMPLETED' > GROUP BY > "party_group"."group_name" > ORDER BY > "party_group"."group_name" ASC > > I need to add in columns like phone numbers and primary contact names, > city states, etc... > > So I guess I need subqueries or some sort of SQL pixie dust, cause I > can't figure out how to query in two different directions (order info > and customer info). > > Help. Anyone got any example SQL scripts around? Or links to examples > that emulate the ofbiz database layout? > > -- > Walter > |
In reply to this post by Walter Vaughan
Walter,
Not entirely sure what the problem is. You can keep on JOINing extra tables (provided you join on appropriate columns - foreign keys, usually) until the cows come home. Bear in mind that since you are using GROUP BY, every "column" in the SELECT clause needs to be either column in the GROUP BY, or an aggregate function. Not sure if this helps... Cheers, Iain Walter Vaughan wrote: > Okay, I'll admit my SQL skill are pre-newbie, but I'm kinda at a loss. > > I'm trying to build some reports, and I am begging for some direction. > The following query works, but I need to add more columns... > > SELECT > "party_group"."group_name" AS "Company_Name" > max("party_classification"."party_classification_group_id") as > "Discount Type", > sum("order_item"."unit_price")as "Discounted Amount", > sum("order_item"."unit_list_price")as "Retail Amount", > count( distinct "order_header"."order_id")as "Number Of Orders" > FROM > "party" INNER JOIN "party_classification" ON "party"."party_id" = > "party_classification"."party_id" > INNER JOIN "order_header" ON "party"."party_id" = > "order_header"."bill_to_party_id" > INNER JOIN "party_group" ON "party"."party_id" = > "party_group"."party_id" > INNER JOIN "order_item" ON "order_header"."order_id" = > "order_item"."order_id" > WHERE > party_classification_group_id LIKE 'DEALER%' > AND "order_item"."status_id" = 'ITEM_COMPLETED' > GROUP BY > "party_group"."group_name" > ORDER BY > "party_group"."group_name" ASC > > I need to add in columns like phone numbers and primary contact names, > city states, etc... > > So I guess I need subqueries or some sort of SQL pixie dust, cause I > can't figure out how to query in two different directions (order info > and customer info). > > Help. Anyone got any example SQL scripts around? Or links to examples > that emulate the ofbiz database layout? > > -- > Walter > > -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.15.31 - Release Date: 13/11/2007 12:00 AM |
In reply to this post by Walter Vaughan
Walter,
SQL cross-products are quite simple, actually, although not immediately obvious to start with. Consider that every join you make is for a specific purpose. Here's a quick contrived example, for illustration only, not congruent with OFBiz entities. Say you join "Party.employees" to "Party", you'll name that join Employees. Your join will look like: "Party P INNER JOIN Party P_EMPLOYEES USING employees". You'll have named your join "P_EMPLOYEES". Say you then join "Party.relatives" to "Party", you'll name that join Relatives. In that way, all fields in P will be the person's particulars. Fields in P_EMPLOYEES will be an employee's particulars. And P_RELATIVES will be a relative's particulars. Yes, a single P row can be listed several times, especially when that paticular person has more than 1 employee or relative. That's how a cross-product looks like, the bread and butter of RDBMS. It's as simple as that! I used a single table "Party" multiple times, so that it's a more complex example that clearly illustrates the concept of "join purposes". As for translating that into DynamicViewEntity or <view-entity>, that's a whole tutorial altogether (tired now :P). Note that "conditional joins" (beyond the key-to-key links) is not possible in OFBiz yet. I raised this issue for possible enhancement some time back, and someone actually submitted a patch. Not sure if that got committed. Jonathhon Walter Vaughan wrote: > Okay, I'll admit my SQL skill are pre-newbie, but I'm kinda at a loss. > > I'm trying to build some reports, and I am begging for some direction. > The following query works, but I need to add more columns... > > SELECT > "party_group"."group_name" AS "Company_Name" > max("party_classification"."party_classification_group_id") as > "Discount Type", > sum("order_item"."unit_price")as "Discounted Amount", > sum("order_item"."unit_list_price")as "Retail Amount", > count( distinct "order_header"."order_id")as "Number Of Orders" > FROM > "party" INNER JOIN "party_classification" ON "party"."party_id" = > "party_classification"."party_id" > INNER JOIN "order_header" ON "party"."party_id" = > "order_header"."bill_to_party_id" > INNER JOIN "party_group" ON "party"."party_id" = > "party_group"."party_id" > INNER JOIN "order_item" ON "order_header"."order_id" = > "order_item"."order_id" > WHERE > party_classification_group_id LIKE 'DEALER%' > AND "order_item"."status_id" = 'ITEM_COMPLETED' > GROUP BY > "party_group"."group_name" > ORDER BY > "party_group"."group_name" ASC > > I need to add in columns like phone numbers and primary contact names, > city states, etc... > > So I guess I need subqueries or some sort of SQL pixie dust, cause I > can't figure out how to query in two different directions (order info > and customer info). > > Help. Anyone got any example SQL scripts around? Or links to examples > that emulate the ofbiz database layout? > > -- > Walter > > |
I have fooled with this all day now and I bet there is someone out there who
knows exactly how to do this. I have a URL, showTransactions that is normally called like this: .../showTransactions?billingAccountId=xyz I have another url; .../findTransactions The user gets dispatched to .../findTransactions and enters a partyId is present with a list of billingAccounts for a customer and they click on the billing account and off they go they go to .../showTransactions?billingAccountId=xyz What I want to do is if there is only one billing account, I don't want them to have to click the link. I want to take them right there. So, I tried writing both a service and a servlet like this: public static Map getBillingAccountCount(DispatchContext dctx, Map context) { and public static String getBillingAccountCount(HttpServletRequest request, HttpServletResponse response) { In the first, I stuffed the billingAccountId in the context. In the second, I stuffed it in an attribute (there is, unfortunately, no setParameter which is exactly what I wanted). Here is a sample of the dispatcher: <request-map uri="findTransactions"> <security https="true" auth="true"/> <!-- <event type="service" invoke="getBillingAccountCount"/> --> <event type="java" path="org.ofbiz.accounting.ar.BillingAccountWorker" invoke="getBillingAccountCount"/> <response name="fail" type="view" value="findTransactions"/> <response name="success" type="view" value="showTransactions"/> </request-map> When the bash script gets called for showTransactions using either method, billingAccountId is not there. Anyone have any ideas on how to do this redirection and add parameters to the request or context? I can do this with a servlet and filters, but I don't understand how Ofbiz handles all that. Skip |
Why don't you just check for billingAccountId in your bsh script, if it's
not there check for a partyId and look up the billing account again? Regards Scott On 17/11/2007, skip@thedevers <[hidden email]> wrote: > > I have fooled with this all day now and I bet there is someone out there > who > knows exactly how to do this. > > I have a URL, showTransactions that is normally called like this: > > .../showTransactions?billingAccountId=xyz > > I have another url; > > .../findTransactions > > The user gets dispatched to .../findTransactions and enters a partyId is > present with a list of billingAccounts for a customer and they click on > the > billing account and off they go they go to > .../showTransactions?billingAccountId=xyz > > What I want to do is if there is only one billing account, I don't want > them > to have to click the link. I want to take them right there. So, I tried > writing both a service and a servlet like this: > > public static Map getBillingAccountCount(DispatchContext dctx, Map > context) { > > and > > public static String getBillingAccountCount(HttpServletRequest > request, > HttpServletResponse response) { > > In the first, I stuffed the billingAccountId in the context. In the > second, > I stuffed it in an attribute (there is, unfortunately, no setParameter > which > is exactly what I wanted). > > Here is a sample of the dispatcher: > > <request-map uri="findTransactions"> > <security https="true" auth="true"/> > <!-- <event type="service" invoke="getBillingAccountCount"/> --> > <event type="java" > path="org.ofbiz.accounting.ar.BillingAccountWorker" > invoke="getBillingAccountCount"/> > <response name="fail" type="view" value="findTransactions"/> > <response name="success" type="view" value="showTransactions"/> > </request-map> > > When the bash script gets called for showTransactions using either method, > billingAccountId is not there. > > Anyone have any ideas on how to do this redirection and add parameters to > the request or context? I can do this with a servlet and filters, but I > don't understand how Ofbiz handles all that. > > Skip > > |
In reply to this post by SkipDever
Not too difficult.
In your controller.xml and in the "findTransaction" request map, have 2 "success" responses, 1 named "success" and the other named "onlyOne". In the <event>, do your finding of transactions, and redirect to the proper response path depending on whether there is only one transaction found or not. Jonathon skip@thedevers wrote: > I have fooled with this all day now and I bet there is someone out there who > knows exactly how to do this. > > I have a URL, showTransactions that is normally called like this: > > .../showTransactions?billingAccountId=xyz > > I have another url; > > .../findTransactions > > The user gets dispatched to .../findTransactions and enters a partyId is > present with a list of billingAccounts for a customer and they click on the > billing account and off they go they go to > .../showTransactions?billingAccountId=xyz > > What I want to do is if there is only one billing account, I don't want them > to have to click the link. I want to take them right there. So, I tried > writing both a service and a servlet like this: > > public static Map getBillingAccountCount(DispatchContext dctx, Map > context) { > > and > > public static String getBillingAccountCount(HttpServletRequest request, > HttpServletResponse response) { > > In the first, I stuffed the billingAccountId in the context. In the second, > I stuffed it in an attribute (there is, unfortunately, no setParameter which > is exactly what I wanted). > > Here is a sample of the dispatcher: > > <request-map uri="findTransactions"> > <security https="true" auth="true"/> > <!-- <event type="service" invoke="getBillingAccountCount"/> --> > <event type="java" > path="org.ofbiz.accounting.ar.BillingAccountWorker" > invoke="getBillingAccountCount"/> > <response name="fail" type="view" value="findTransactions"/> > <response name="success" type="view" value="showTransactions"/> > </request-map> > > When the bash script gets called for showTransactions using either method, > billingAccountId is not there. > > Anyone have any ideas on how to do this redirection and add parameters to > the request or context? I can do this with a servlet and filters, but I > don't understand how Ofbiz handles all that. > > Skip > > |
In reply to this post by SkipDever
are you using the controller and widgets.
you can call bsh files from the action and make this one operation. have you looked at <request-map uri="orderentry"> <security https="true" auth="true"/> <event type="java" path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="routeOrderEntry"/> <response name="init" type="view" value="checkinits"/> <response name="agreements" type="view" value="orderagreements"/> <response name="cart" type="view" value="showcart"/> <response name="error" type="view" value="checkinits"/> </request-map> skip@thedevers sent the following on 11/16/2007 7:06 PM: > I have fooled with this all day now and I bet there is someone out there who > knows exactly how to do this. > > I have a URL, showTransactions that is normally called like this: > > .../showTransactions?billingAccountId=xyz > > I have another url; > > .../findTransactions > > The user gets dispatched to .../findTransactions and enters a partyId is > present with a list of billingAccounts for a customer and they click on the > billing account and off they go they go to > .../showTransactions?billingAccountId=xyz > > What I want to do is if there is only one billing account, I don't want them > to have to click the link. I want to take them right there. So, I tried > writing both a service and a servlet like this: > > public static Map getBillingAccountCount(DispatchContext dctx, Map > context) { > > and > > public static String getBillingAccountCount(HttpServletRequest request, > HttpServletResponse response) { > > In the first, I stuffed the billingAccountId in the context. In the second, > I stuffed it in an attribute (there is, unfortunately, no setParameter which > is exactly what I wanted). > > Here is a sample of the dispatcher: > > <request-map uri="findTransactions"> > <security https="true" auth="true"/> > <!-- <event type="service" invoke="getBillingAccountCount"/> --> > <event type="java" > path="org.ofbiz.accounting.ar.BillingAccountWorker" > invoke="getBillingAccountCount"/> > <response name="fail" type="view" value="findTransactions"/> > <response name="success" type="view" value="showTransactions"/> > </request-map> > > When the bash script gets called for showTransactions using either method, > billingAccountId is not there. > > Anyone have any ideas on how to do this redirection and add parameters to > the request or context? I can do this with a servlet and filters, but I > don't understand how Ofbiz handles all that. > > Skip > > > > |
Thanks to all who replied on this, but I guess I didn't explain it well. I
have no problem dispatching to one URL or the other, I can return any response I want. The problem is this: <request-map uri="findTransactions"> <security https="true" auth="true"/> <!-- <event type="service" invoke="getBillingAccountCount"/> --> <event type="java" path="org.ofbiz.accounting.ar.BillingAccountWorker" invoke="getBillingAccountCount"/> <response name="fail" type="view" value="findTransactions"/> <response name="success" type="view" value="showTransactions"/> </request-map> On pass one through this findTransactions, fail is returned because there are no entries (no customer or billing account entered) and findTransactions gets called. This is correct. On pass two, the user has entered either a customerId or a billingAccountId. If there is only one, getBillingAccountCount returns success and showTransactions gets called. This is correct. The problem is that the billingAccountId I stuffed in getBillingAccountCount is not available to the bash script associated with showTransactions. And yes, this is all based on plainolde widgets. I tried the following: request.setAttribute("billingAccountId", billingAccountId); and for the service context.put("billingAccountId", billingAccountId); Neither results in the bash script loaded by showTransactions having the billingAccountId available. To answer Scott, yes, I could take this cheating way out because I do have the customerId, but this was an excercise as well as the solution to a single problem. I have other needs for a technique like this. For example, the customer could enter a partial customer name or billingAccountId and I could still show the screen if only one result matched. The question is, how to get the data I find in getBillingAccountCount into the bash script in showTransactions. I hate to stuff it in the session when it really belongs in the request. I don't want to clutter up the session object like that. However, I read this in the Javadocs "Attributes are reset between requests". So I guess that going from getBillingAccountCount to showTransactions means that it is a new request even though nothing has been emitted back to the browser? Skip -----Original Message----- From: BJ Freeman [mailto:[hidden email]] Sent: Friday, November 16, 2007 7:44 PM To: [hidden email] Subject: Re: Difficult Question are you using the controller and widgets. you can call bsh files from the action and make this one operation. have you looked at <request-map uri="orderentry"> <security https="true" auth="true"/> <event type="java" path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="routeOrderEntry"/> <response name="init" type="view" value="checkinits"/> <response name="agreements" type="view" value="orderagreements"/> <response name="cart" type="view" value="showcart"/> <response name="error" type="view" value="checkinits"/> </request-map> skip@thedevers sent the following on 11/16/2007 7:06 PM: > I have fooled with this all day now and I bet there is someone out there who > knows exactly how to do this. > > I have a URL, showTransactions that is normally called like this: > > .../showTransactions?billingAccountId=xyz > > I have another url; > > .../findTransactions > > The user gets dispatched to .../findTransactions and enters a partyId is > present with a list of billingAccounts for a customer and they click on > billing account and off they go they go to > .../showTransactions?billingAccountId=xyz > > What I want to do is if there is only one billing account, I don't want them > to have to click the link. I want to take them right there. So, I tried > writing both a service and a servlet like this: > > public static Map getBillingAccountCount(DispatchContext dctx, Map > context) { > > and > > public static String getBillingAccountCount(HttpServletRequest request, > HttpServletResponse response) { > > In the first, I stuffed the billingAccountId in the context. In the second, > I stuffed it in an attribute (there is, unfortunately, no setParameter which > is exactly what I wanted). > > Here is a sample of the dispatcher: > > <request-map uri="findTransactions"> > <security https="true" auth="true"/> > <!-- <event type="service" invoke="getBillingAccountCount"/> --> > <event type="java" > path="org.ofbiz.accounting.ar.BillingAccountWorker" > invoke="getBillingAccountCount"/> > <response name="fail" type="view" value="findTransactions"/> > <response name="success" type="view" value="showTransactions"/> > </request-map> > > When the bash script gets called for showTransactions using either method, > billingAccountId is not there. > > Anyone have any ideas on how to do this redirection and add parameters to > the request or context? I can do this with a servlet and filters, but I > don't understand how Ofbiz handles all that. > > Skip > > > > |
request.setAttribute works I just tried it.
Regards Scott On 17/11/2007, skip@thedevers <[hidden email]> wrote: > > Thanks to all who replied on this, but I guess I didn't explain it > well. I > have no problem dispatching to one URL or the other, I can return any > response I want. The problem is this: > > <request-map uri="findTransactions"> > <security https="true" auth="true"/> > <!-- <event type="service" invoke="getBillingAccountCount"/> --> > <event type="java" > path="org.ofbiz.accounting.ar.BillingAccountWorker" > invoke="getBillingAccountCount"/> > <response name="fail" type="view" value="findTransactions"/> > <response name="success" type="view" value="showTransactions"/> > </request-map> > > On pass one through this findTransactions, fail is returned because there > are no entries (no customer or billing account entered) and > findTransactions > gets called. This is correct. On pass two, the user has entered either a > customerId or a billingAccountId. If there is only one, > getBillingAccountCount returns success and showTransactions gets called. > This is correct. The problem is that the billingAccountId I stuffed in > getBillingAccountCount is not available to the bash script associated with > showTransactions. And yes, this is all based on plainolde widgets. I > tried the following: > > request.setAttribute("billingAccountId", billingAccountId); > > and for the service > > context.put("billingAccountId", billingAccountId); > > > > Neither results in the bash script loaded by showTransactions having the > billingAccountId available. > > To answer Scott, yes, I could take this cheating way out because I do have > the customerId, but this was an excercise as well as the solution to a > single problem. I have other needs for a technique like this. For > example, > the customer could enter a partial customer name or billingAccountId and I > could still show the screen if only one result matched. > > The question is, how to get the data I find in getBillingAccountCount into > the bash script in showTransactions. I hate to stuff it in the session > when > it really belongs in the request. I don't want to clutter up the session > object like that. > > However, I read this in the Javadocs "Attributes are reset between > requests". So I guess that going from getBillingAccountCount to > showTransactions means that it is a new request even though nothing has > been > emitted back to the browser? > > > Skip > > > > -----Original Message----- > From: BJ Freeman [mailto:[hidden email]] > Sent: Friday, November 16, 2007 7:44 PM > To: [hidden email] > Subject: Re: Difficult Question > > > are you using the controller and widgets. > you can call bsh files from the action and make this one operation. > > have you looked at > <request-map uri="orderentry"> > <security https="true" auth="true"/> > <event type="java" > path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" > invoke="routeOrderEntry"/> > <response name="init" type="view" value="checkinits"/> > <response name="agreements" type="view" value="orderagreements"/> > <response name="cart" type="view" value="showcart"/> > <response name="error" type="view" value="checkinits"/> > </request-map> > > > > > > skip@thedevers sent the following on 11/16/2007 7:06 PM: > > I have fooled with this all day now and I bet there is someone out there > who > > knows exactly how to do this. > > > > I have a URL, showTransactions that is normally called like this: > > > > .../showTransactions?billingAccountId=xyz > > > > I have another url; > > > > .../findTransactions > > > > The user gets dispatched to .../findTransactions and enters a partyId is > > present with a list of billingAccounts for a customer and they click on > the > > billing account and off they go they go to > > .../showTransactions?billingAccountId=xyz > > > > What I want to do is if there is only one billing account, I don't want > them > > to have to click the link. I want to take them right there. So, I > tried > > writing both a service and a servlet like this: > > > > public static Map getBillingAccountCount(DispatchContext dctx, Map > > context) { > > > > and > > > > public static String getBillingAccountCount(HttpServletRequest > request, > > HttpServletResponse response) { > > > > In the first, I stuffed the billingAccountId in the context. In the > second, > > I stuffed it in an attribute (there is, unfortunately, no setParameter > which > > is exactly what I wanted). > > > > Here is a sample of the dispatcher: > > > > <request-map uri="findTransactions"> > > <security https="true" auth="true"/> > > <!-- <event type="service" invoke="getBillingAccountCount"/> --> > > <event type="java" > > path="org.ofbiz.accounting.ar.BillingAccountWorker" > > invoke="getBillingAccountCount"/> > > <response name="fail" type="view" value="findTransactions"/> > > <response name="success" type="view" value="showTransactions"/> > > </request-map> > > > > When the bash script gets called for showTransactions using either > method, > > billingAccountId is not there. > > > > Anyone have any ideas on how to do this redirection and add parameters > to > > the request or context? I can do this with a servlet and filters, but I > > don't understand how Ofbiz handles all that. > > > > Skip > > > > > > > > > > |
Scott
You are 100% right. My problem before was that request.getAttribute() for the two variables (partyId and billingAccountId) were null. I tried request.getParameter() and that yielded the contents of the previous screen which is exactly what I wanted. So I now have a bash script that looks like this: billingAccountId = parameters.get("billingAccountId"); if(billingAccountId == null || billingAccountId.length() < 1) billingAccountId = request.getAttribute("billingAccountId"); and a dispatcher that looks like this: <request-map uri="findTransactions"> <security https="true" auth="true"/> <!-- <event type="service" invoke="getBillingAccountCount"/> --> <event type="java" path="org.ofbiz.accounting.ar.BillingAccountWorker" invoke="getBillingAccountCount"/> <response name="fail" type="view" value="findTransactions"/> <response name="success" type="view" value="showTransactions"/> </request-map> That works a charm. I can now call it either way. The service based one does not work in case anyone is interested. Thanks for the help. Skip -----Original Message----- From: Scott Gray [mailto:[hidden email]] Sent: Friday, November 16, 2007 10:12 PM To: [hidden email] Subject: Re: Difficult Question request.setAttribute works I just tried it. Regards Scott On 17/11/2007, skip@thedevers <[hidden email]> wrote: > > Thanks to all who replied on this, but I guess I didn't explain it > well. I > have no problem dispatching to one URL or the other, I can return any > response I want. The problem is this: > > <request-map uri="findTransactions"> > <security https="true" auth="true"/> > <!-- <event type="service" invoke="getBillingAccountCount"/> --> > <event type="java" > path="org.ofbiz.accounting.ar.BillingAccountWorker" > invoke="getBillingAccountCount"/> > <response name="fail" type="view" value="findTransactions"/> > <response name="success" type="view" value="showTransactions"/> > </request-map> > > On pass one through this findTransactions, fail is returned because there > are no entries (no customer or billing account entered) and > findTransactions > gets called. This is correct. On pass two, the user has entered either a > customerId or a billingAccountId. If there is only one, > getBillingAccountCount returns success and showTransactions gets called. > This is correct. The problem is that the billingAccountId I stuffed in > getBillingAccountCount is not available to the bash script associated with > showTransactions. And yes, this is all based on plainolde widgets. I > tried the following: > > request.setAttribute("billingAccountId", billingAccountId); > > and for the service > > context.put("billingAccountId", billingAccountId); > > > > Neither results in the bash script loaded by showTransactions having the > billingAccountId available. > > To answer Scott, yes, I could take this cheating way out because I do have > the customerId, but this was an excercise as well as the solution to a > single problem. I have other needs for a technique like this. For > example, > the customer could enter a partial customer name or billingAccountId and I > could still show the screen if only one result matched. > > The question is, how to get the data I find in getBillingAccountCount into > the bash script in showTransactions. I hate to stuff it in the session > when > it really belongs in the request. I don't want to clutter up the session > object like that. > > However, I read this in the Javadocs "Attributes are reset between > requests". So I guess that going from getBillingAccountCount to > showTransactions means that it is a new request even though nothing has > been > emitted back to the browser? > > > Skip > > > > -----Original Message----- > From: BJ Freeman [mailto:[hidden email]] > Sent: Friday, November 16, 2007 7:44 PM > To: [hidden email] > Subject: Re: Difficult Question > > > are you using the controller and widgets. > you can call bsh files from the action and make this one operation. > > have you looked at > <request-map uri="orderentry"> > <security https="true" auth="true"/> > <event type="java" > path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" > invoke="routeOrderEntry"/> > <response name="init" type="view" value="checkinits"/> > <response name="agreements" type="view" value="orderagreements"/> > <response name="cart" type="view" value="showcart"/> > <response name="error" type="view" value="checkinits"/> > </request-map> > > > > > > skip@thedevers sent the following on 11/16/2007 7:06 PM: > > I have fooled with this all day now and I bet there is someone out there > who > > knows exactly how to do this. > > > > I have a URL, showTransactions that is normally called like this: > > > > .../showTransactions?billingAccountId=xyz > > > > I have another url; > > > > .../findTransactions > > > > The user gets dispatched to .../findTransactions and enters a partyId is > > present with a list of billingAccounts for a customer and they click on > the > > billing account and off they go they go to > > .../showTransactions?billingAccountId=xyz > > > > What I want to do is if there is only one billing account, I don't want > them > > to have to click the link. I want to take them right there. So, I > tried > > writing both a service and a servlet like this: > > > > public static Map getBillingAccountCount(DispatchContext dctx, Map > > context) { > > > > and > > > > public static String getBillingAccountCount(HttpServletRequest > request, > > HttpServletResponse response) { > > > > In the first, I stuffed the billingAccountId in the context. In the > second, > > I stuffed it in an attribute (there is, unfortunately, no setParameter > which > > is exactly what I wanted). > > > > Here is a sample of the dispatcher: > > > > <request-map uri="findTransactions"> > > <security https="true" auth="true"/> > > <!-- <event type="service" invoke="getBillingAccountCount"/> --> > > <event type="java" > > path="org.ofbiz.accounting.ar.BillingAccountWorker" > > invoke="getBillingAccountCount"/> > > <response name="fail" type="view" value="findTransactions"/> > > <response name="success" type="view" value="showTransactions"/> > > </request-map> > > > > When the bash script gets called for showTransactions using either > method, > > billingAccountId is not there. > > > > Anyone have any ideas on how to do this redirection and add parameters > to > > the request or context? I can do this with a servlet and filters, but I > > don't understand how Ofbiz handles all that. > > > > Skip > > > > > > > > > > |
On 17/11/2007, skip@thedevers <[hidden email]> wrote:
> > if(billingAccountId == null || billingAccountId.length() < 1) > Use UtilValidate.isEmpty(billingAccountId) instead, saves a bit of typing > Thanks for the help. No worries Scott |
In reply to this post by jonwimp
My code is doing lots of conversions between BigDecimal to Double for
GenericValue.put() on "currency-amount" fields. Can I just put() the BigDecimal instead? I know I can test this pretty quick, but I am betting someone knows what is the most efficient way. Skip |
Off the top of my head, I'm pretty sure you can put them in fine but you
will get warnings in the logs about it. I think the only time you run into trouble is when the java type and the db column type are incompatible. Regards Scott On 23/11/2007, skip@thedevers <[hidden email]> wrote: > > My code is doing lots of conversions between BigDecimal to Double for > GenericValue.put() on "currency-amount" fields. > > Can I just put() the BigDecimal instead? > > I know I can test this pretty quick, but I am betting someone knows what > is > the most efficient way. > > Skip > > |
In reply to this post by SkipDever
Should there be a way to unsubscribe an email address
from the list. It's been requested many times. Thanks. ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs |
Administrator
|
De : "Canh Phan" <[hidden email]>
> Should there be a way to unsubscribe an email address > from the list. It's been requested many times. > > Thanks. http://docs.ofbiz.org/display/OFBADMIN/Mailing+Lists |
In reply to this post by Canh Phan
--- Canh Phan <[hidden email]> wrote: > Should there be a way to unsubscribe an email > address > from the list. It's been requested many times. > > Thanks. > > > > > > Never miss a thing. Make Yahoo your home page. > http://www.yahoo.com/r/hs > ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs |
In reply to this post by Jacques Le Roux
Could an admin please remove [hidden email] manually?
In general pointing to the documentation works. However, in this case it seems that Cahn is unable to follow the directions on the Mailing Lists page. Additionally, the following explicit instructions could be added to the Mailing Lists page ... "To unsubscribe from any of the following lists, you need to send an empty, subjectless email to unsubscribe address listed below. In other words, click the appropriate unsubscribe link below and press send." -----Original Message----- From: Jacques Le Roux [mailto:[hidden email]] Sent: November 23, 2007 9:03 AM To: [hidden email] Subject: Re: Unsubscribe De : "Canh Phan" <[hidden email]> > Should there be a way to unsubscribe an email address > from the list. It's been requested many times. > > Thanks. http://docs.ofbiz.org/display/OFBADMIN/Mailing+Lists |
Administrator
|
Gavin,
Thanks for suggestion, I added your comment. I'm a moderator of those lists (or I was since I did not see a message to moderat since 09/14/07. BTW is that normal, even if I prefer it ? ;o) but I don't know (or have the rights) to remove Cahn from the list. And like David said already many times.Two common problems people run into: 1. sending the message from an email address different from the one subscribed 2. receiving the reply, but having it caught by a junk mail filter BTW I think it would be fair to actualise the content of http://lists.ofbiz.org/mailman/listinfo Jacques De : "Gavin Bee" <[hidden email]> > Could an admin please remove [hidden email] manually? > > In general pointing to the documentation works. However, in this case it > seems that Cahn is unable to follow the directions on the Mailing Lists > page. > > Additionally, the following explicit instructions could be added to the > Mailing Lists page ... "To unsubscribe from any of the following lists, you > need to send an empty, subjectless email to unsubscribe address listed > below. In other words, click the appropriate unsubscribe link below and > press send." > > -----Original Message----- > From: Jacques Le Roux [mailto:[hidden email]] > Sent: November 23, 2007 9:03 AM > To: [hidden email] > Subject: Re: Unsubscribe > > De : "Canh Phan" <[hidden email]> > > Should there be a way to unsubscribe an email address > > from the list. It's been requested many times. > > > > Thanks. > > http://docs.ofbiz.org/display/OFBADMIN/Mailing+Lists > |
one of the list servers I am on sends out a ping message, something
similar to the ezmlm warning on our ml it if bounces it tries one more time then removes the email from the list. this would take care of emails that can not be accessed by the user. Jacques Le Roux sent the following on 11/23/2007 2:24 PM: > Gavin, > > Thanks for suggestion, I added your comment. I'm a moderator of those lists (or I was since I did not see a message to moderat since > 09/14/07. BTW is that normal, even if I prefer it ? ;o) but I don't know (or have the rights) to remove Cahn from the list. > > And like David said already many times.Two common problems people run into: > 1. sending the message from an email address different from the one subscribed > 2. receiving the reply, but having it caught by a junk mail filter > > BTW I think it would be fair to actualise the content of http://lists.ofbiz.org/mailman/listinfo > > Jacques > > De : "Gavin Bee" <[hidden email]> >> Could an admin please remove [hidden email] manually? >> >> In general pointing to the documentation works. However, in this case it >> seems that Cahn is unable to follow the directions on the Mailing Lists >> page. >> >> Additionally, the following explicit instructions could be added to the >> Mailing Lists page ... "To unsubscribe from any of the following lists, you >> need to send an empty, subjectless email to unsubscribe address listed >> below. In other words, click the appropriate unsubscribe link below and >> press send." >> >> -----Original Message----- >> From: Jacques Le Roux [mailto:[hidden email]] >> Sent: November 23, 2007 9:03 AM >> To: [hidden email] >> Subject: Re: Unsubscribe >> >> De : "Canh Phan" <[hidden email]> >>> Should there be a way to unsubscribe an email address >>> from the list. It's been requested many times. >>> >>> Thanks. >> http://docs.ofbiz.org/display/OFBADMIN/Mailing+Lists >> > > > > |
Free forum by Nabble | Edit this page |