hi,
I want to view the order page using the requirementId passed to the order view page. The code should search the orderID associate with the requirement ID in the entity OrderRequirementCommitment, and then display the order. In the OrderView.groovy file i thus the following code, but its not working: requirementId = parameters.requirementId; orderRequirement = null; requirement = null; requirement = delegator.findByPrimaryKey("Requirement", [requirementId : requirementId]); orderRequirement = requirement.getRelated("OrderRequirementCommitment"); orderId = orderRequirement("orderId"); context.orderId = orderId; I guess the problem is that the relationship is not one-to-one and i am getting the below error, any help will be appreciated. ERROR rendering error page [/error/error.jsp], but here is the error text: org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen [component://snjPurchasing/widget/snjPurchasingScreens.xml#ViewRequirement]: groovy.lang.MissingMethodException: No signature of method: javolution.util.FastMap.call() is applicable for argument types: (java.lang.String) values: [orderId] Possible solutions: tail(), wait(), any(), wait(long), any(groovy.lang.Closure), each(groovy.lang.Closure) (No signature of method: javolution.util.FastMap.call() is applicable for argument types: (java.lang.String) values: [orderId] Possible solutions: tail(), wait(), any(), wait(long), any(groovy.lang.Closure), each(groovy.lang.Closure)) |
Hello Rohit,
Correct following line orderId = orderRequirement("orderId"); to orderId = orderRequirement.orderId; -- Thanks and Regards Santosh Malviya On Sat, Jul 24, 2010 at 2:21 PM, rohit <[hidden email]> wrote: > > hi, > > I want to view the order page using the requirementId passed to the order > view page. The code should search the orderID associate with the > requirement > ID in the entity OrderRequirementCommitment, and then display the order. > > In the OrderView.groovy file i thus the following code, but its not > working: > > requirementId = parameters.requirementId; > orderRequirement = null; > requirement = null; > > requirement = delegator.findByPrimaryKey("Requirement", [requirementId : > requirementId]); > orderRequirement = requirement.getRelated("OrderRequirementCommitment"); > > orderId = orderRequirement("orderId"); > context.orderId = orderId; > > I guess the problem is that the relationship is not one-to-one and i am > getting the below error, any help will be appreciated. > > ERROR rendering error page [/error/error.jsp], but here is the error text: > org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen > > [component://snjPurchasing/widget/snjPurchasingScreens.xml#ViewRequirement]: > groovy.lang.MissingMethodException: No signature of method: > javolution.util.FastMap.call() is applicable for argument types: > (java.lang.String) values: [orderId] Possible solutions: tail(), wait(), > any(), wait(long), any(groovy.lang.Closure), each(groovy.lang.Closure) (No > signature of method: javolution.util.FastMap.call() is applicable for > argument types: (java.lang.String) values: [orderId] Possible solutions: > tail(), wait(), any(), wait(long), any(groovy.lang.Closure), > each(groovy.lang.Closure)) > > -- > View this message in context: > http://ofbiz.135035.n4.nabble.com/help-with-groovy-file-tp2300959p2300959.html > Sent from the OFBiz - User mailing list archive at Nabble.com. > |
i did, now it shows the below error:
(SQL Exception while setting value on field [orderId] of entity OrderHeader: (An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'Types.JAVA_OBJECT'.)) (Error running Groovy script at location [component://snjPurchasing/webapp/snjPurchasing/WEB-INF/actions/ViewRequirement.groovy] (SQL Exception while setting value on field [orderId] of entity OrderHeader: (An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'Types.JAVA_OBJECT'.))) |
Hello Rohit,
Relation between Requirement entity and OrderRequirementCommitment is many to one, so from below line requirement.getRelated("OrderRequirementCommitment"); you will get a list which is "orderRequirement" and you have to iterate this list and then get orderId and set to context. HTH -- Thanks and Regards Santosh Malviya On Sat, Jul 24, 2010 at 2:57 PM, rohit <[hidden email]> wrote: > > i did, now it srequirement.getRelated(" > OrderRequirementCommitment"); > hows the below error: > > (SQL Exception while setting value on field [orderId] of entity > OrderHeader: > (An attempt was made to get a data value of type 'VARCHAR' from a data > value > of type 'Types.JAVA_OBJECT'.)) (Error running Groovy script at location > > [component://snjPurchasing/webapp/snjPurchasing/WEB-INF/actions/ViewRequirement.groovy] > (SQL Exception while setting value on field [orderId] of entity > OrderHeader: > (An attempt was made to get a data value of type 'VARCHAR' from a data > value > of type 'Types.JAVA_OBJECT'.))) > -- > View this message in context: > http://ofbiz.135035.n4.nabble.com/help-with-groovy-file-tp2300959p2300980.html > Sent from the OFBiz - User mailing list archive at Nabble.com. > |
Free forum by Nabble | Edit this page |