Hi,
I would like to write a form widget where the user can select all products that fulfill some constraints. The constraint should be input using some drop-down fields. With the following code I get that in the drop-down field the same option is displayed many times (because there are many records with that value) while it should be only displayed once. <field name="diamId" title="Diametro" position="3"> <drop-down allow-empty="true"> <entity-options description="${diamId}" entity-name="Product"> <entity-order-by field-name="diamId"/> </entity-options> </drop-down> </field> Can someone tell me how to populate the drop-down options having each option displayed only once? Many thanks, -Bruno |
Can someone, please help me with this?
Looking through the ofbiz code I always find the entity-options in drop-down tag used with unique entity key fields. What I am trying to do is to populate the drop-down with a non unique entity key field (and having it displayed only once). Is it a wrong use of drop-down/entity-options ? Has someone done this I am trying to do? Is there an alternative method? Many thanks, -Bruno 2008/5/5 Bruno Busco <[hidden email]>: > Hi, > I would like to write a form widget where the user can select all products > that fulfill some constraints. > The constraint should be input using some drop-down fields. > With the following code I get that in the drop-down field the same option > is displayed many times (because there are many records with that value) > while it should be only displayed once. > > <field name="diamId" title="Diametro" position="3"> > <drop-down allow-empty="true"> > <entity-options description="${diamId}" > entity-name="Product"> > <entity-order-by field-name="diamId"/> > </entity-options> > </drop-down> > </field> > > Can someone tell me how to populate the drop-down options having each > option displayed only once? > > Many thanks, > > -Bruno > |
Try using a bsh script to do a distinct query and then use list-options in
your form instead of entity-options Regards Scott 2008/5/11 Bruno Busco <[hidden email]>: > Can someone, please help me with this? > Looking through the ofbiz code I always find the entity-options in > drop-down > tag used with unique entity key fields. > What I am trying to do is to populate the drop-down with a non unique > entity > key field (and having it displayed only once). > Is it a wrong use of drop-down/entity-options ? > Has someone done this I am trying to do? > Is there an alternative method? > > Many thanks, > -Bruno > > 2008/5/5 Bruno Busco <[hidden email]>: > > > Hi, > > I would like to write a form widget where the user can select all > products > > that fulfill some constraints. > > The constraint should be input using some drop-down fields. > > With the following code I get that in the drop-down field the same option > > is displayed many times (because there are many records with that value) > > while it should be only displayed once. > > > > <field name="diamId" title="Diametro" position="3"> > > <drop-down allow-empty="true"> > > <entity-options description="${diamId}" > > entity-name="Product"> > > <entity-order-by field-name="diamId"/> > > </entity-options> > > </drop-down> > > </field> > > > > Can someone tell me how to populate the drop-down options having each > > option displayed only once? > > > > Many thanks, > > > > -Bruno > > > |
Many thanks Scott,
I will follow your indications, BTW is there some documentation where to learn the entity query mechanism? -Bruno 2008/5/11 Scott Gray <[hidden email]>: > Try using a bsh script to do a distinct query and then use list-options in > your form instead of entity-options > > Regards > Scott > > 2008/5/11 Bruno Busco <[hidden email]>: > > > Can someone, please help me with this? > > Looking through the ofbiz code I always find the entity-options in > > drop-down > > tag used with unique entity key fields. > > What I am trying to do is to populate the drop-down with a non unique > > entity > > key field (and having it displayed only once). > > Is it a wrong use of drop-down/entity-options ? > > Has someone done this I am trying to do? > > Is there an alternative method? > > > > Many thanks, > > -Bruno > > > > 2008/5/5 Bruno Busco <[hidden email]>: > > > > > Hi, > > > I would like to write a form widget where the user can select all > > products > > > that fulfill some constraints. > > > The constraint should be input using some drop-down fields. > > > With the following code I get that in the drop-down field the same > option > > > is displayed many times (because there are many records with that > value) > > > while it should be only displayed once. > > > > > > <field name="diamId" title="Diametro" position="3"> > > > <drop-down allow-empty="true"> > > > <entity-options description="${diamId}" > > > entity-name="Product"> > > > <entity-order-by field-name="diamId"/> > > > </entity-options> > > > </drop-down> > > > </field> > > > > > > Can someone tell me how to populate the drop-down options having each > > > option displayed only once? > > > > > > Many thanks, > > > > > > -Bruno > > > > > > |
Administrator
|
In reply to this post by Scott Gray
Yes, I have a look this morning and I can't see a way to do it with entity-options. A good way to find a solution in such cases is
to look for (for instance) entity-options in *.xsd files. You would find some documentation and maybe some ideas. Sometimes xml completion tools (editors) are not enough to tell you all the story Jacques From: "Scott Gray" <[hidden email]> > Try using a bsh script to do a distinct query and then use list-options in > your form instead of entity-options > > Regards > Scott > > 2008/5/11 Bruno Busco <[hidden email]>: > >> Can someone, please help me with this? >> Looking through the ofbiz code I always find the entity-options in >> drop-down >> tag used with unique entity key fields. >> What I am trying to do is to populate the drop-down with a non unique >> entity >> key field (and having it displayed only once). >> Is it a wrong use of drop-down/entity-options ? >> Has someone done this I am trying to do? >> Is there an alternative method? >> >> Many thanks, >> -Bruno >> >> 2008/5/5 Bruno Busco <[hidden email]>: >> >> > Hi, >> > I would like to write a form widget where the user can select all >> products >> > that fulfill some constraints. >> > The constraint should be input using some drop-down fields. >> > With the following code I get that in the drop-down field the same option >> > is displayed many times (because there are many records with that value) >> > while it should be only displayed once. >> > >> > <field name="diamId" title="Diametro" position="3"> >> > <drop-down allow-empty="true"> >> > <entity-options description="${diamId}" >> > entity-name="Product"> >> > <entity-order-by field-name="diamId"/> >> > </entity-options> >> > </drop-down> >> > </field> >> > >> > Can someone tell me how to populate the drop-down options having each >> > option displayed only once? >> > >> > Many thanks, >> > >> > -Bruno >> > >> > |
I used a bsh script with a findList call (using the setDistinct(true) method
of an EntityFindOption object) and works like a sharm. Many thanks, -Bruno 2008/5/11 Jacques Le Roux <[hidden email]>: > Yes, I have a look this morning and I can't see a way to do it with > entity-options. A good way to find a solution in such cases is to look for > (for instance) entity-options in *.xsd files. You would find some > documentation and maybe some ideas. Sometimes xml completion tools (editors) > are not enough to tell you all the story > > Jacques > > From: "Scott Gray" <[hidden email]> > > Try using a bsh script to do a distinct query and then use list-options > > in > > your form instead of entity-options > > > > Regards > > Scott > > > > 2008/5/11 Bruno Busco <[hidden email]>: > > > > Can someone, please help me with this? > > > Looking through the ofbiz code I always find the entity-options in > > > drop-down > > > tag used with unique entity key fields. > > > What I am trying to do is to populate the drop-down with a non unique > > > entity > > > key field (and having it displayed only once). > > > Is it a wrong use of drop-down/entity-options ? > > > Has someone done this I am trying to do? > > > Is there an alternative method? > > > > > > Many thanks, > > > -Bruno > > > > > > 2008/5/5 Bruno Busco <[hidden email]>: > > > > > > > Hi, > > > > I would like to write a form widget where the user can select all > > > products > > > > that fulfill some constraints. > > > > The constraint should be input using some drop-down fields. > > > > With the following code I get that in the drop-down field the same > > > option > > > > is displayed many times (because there are many records with that > > > value) > > > > while it should be only displayed once. > > > > > > > > <field name="diamId" title="Diametro" position="3"> > > > > <drop-down allow-empty="true"> > > > > <entity-options description="${diamId}" > > > > entity-name="Product"> > > > > <entity-order-by field-name="diamId"/> > > > > </entity-options> > > > > </drop-down> > > > > </field> > > > > > > > > Can someone tell me how to populate the drop-down options having > > > each > > > > option displayed only once? > > > > > > > > Many thanks, > > > > > > > > -Bruno > > > > > > > > > > > > > |
bump this up to answer the question just ask in user ML.
Bruno Busco sent the following on 5/12/2008 1:44 PM: > I used a bsh script with a findList call (using the setDistinct(true) method > of an EntityFindOption object) and works like a sharm. > > Many thanks, > -Bruno > > 2008/5/11 Jacques Le Roux <[hidden email]>: > >> Yes, I have a look this morning and I can't see a way to do it with >> entity-options. A good way to find a solution in such cases is to look for >> (for instance) entity-options in *.xsd files. You would find some >> documentation and maybe some ideas. Sometimes xml completion tools (editors) >> are not enough to tell you all the story >> >> Jacques >> >> From: "Scott Gray" <[hidden email]> >> >> Try using a bsh script to do a distinct query and then use list-options >>> in >>> your form instead of entity-options >>> >>> Regards >>> Scott >>> >>> 2008/5/11 Bruno Busco <[hidden email]>: >>> >>> Can someone, please help me with this? >>>> Looking through the ofbiz code I always find the entity-options in >>>> drop-down >>>> tag used with unique entity key fields. >>>> What I am trying to do is to populate the drop-down with a non unique >>>> entity >>>> key field (and having it displayed only once). >>>> Is it a wrong use of drop-down/entity-options ? >>>> Has someone done this I am trying to do? >>>> Is there an alternative method? >>>> >>>> Many thanks, >>>> -Bruno >>>> >>>> 2008/5/5 Bruno Busco <[hidden email]>: >>>> >>>>> Hi, >>>>> I would like to write a form widget where the user can select all >>>> products >>>>> that fulfill some constraints. >>>>> The constraint should be input using some drop-down fields. >>>>> With the following code I get that in the drop-down field the same >>>> option >>>>> is displayed many times (because there are many records with that >>>> value) >>>>> while it should be only displayed once. >>>>> >>>>> <field name="diamId" title="Diametro" position="3"> >>>>> <drop-down allow-empty="true"> >>>>> <entity-options description="${diamId}" >>>>> entity-name="Product"> >>>>> <entity-order-by field-name="diamId"/> >>>>> </entity-options> >>>>> </drop-down> >>>>> </field> >>>>> >>>>> Can someone tell me how to populate the drop-down options having >>>> each >>>>> option displayed only once? >>>>> >>>>> Many thanks, >>>>> >>>>> -Bruno >>>>> >>>> > |
Free forum by Nabble | Edit this page |