How to set list to map

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to set list to map

SRINIKALLS
Hi


        In Minilang simple-method, is to possible to set a list value to map?


Thanks & Regards
Prashanth Jilla
Reply | Threaded
Open this post in threaded view
|

Re: How to set list to map

Chirag Manocha
Hi Prashanth,

You can iterate list by create your map as :-

<set field="key" value="1"/>
<iterate list="valueList" entry="value">
    <set field="mapName.key${key}" from-field="value"/>
    <!-- Or you can use
    <set field="mapName.${value}" from-field="value"/>
    -->
    <set field="key" value="${key + 1}"/>
</iterate>

This will give you direction for making your keys for map and obviously map.
Use it accordingly.

Regards
--
Chirag Manocha
HotWax Media Pvt. Ltd.
Website :- www.hotwaxmedia.com
Contact :- +91-98263-19099



On Tue, Jul 7, 2009 at 4:26 PM, SRINIKALLS <[hidden email]
> wrote:

>
> Hi
>
>
>        In Minilang simple-method, is to possible to set a list value to
> map?
>
>
> Thanks & Regards
> Prashanth Jilla
> --
> View this message in context:
> http://www.nabble.com/How-to-set-list-to-map-tp24371114p24371114.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: How to set list to map

SRINIKALLS
   here the from-field type is BigDecimal and while iterating its giving the error as :
UEL exception while getting value: java.lang.NumberFormatException: For input string:

so how to convert or set the fields in this senario

Chirag Manocha wrote
Hi Prashanth,

You can iterate list by create your map as :-

<set field="key" value="1"/>
<iterate list="valueList" entry="value">
    <set field="mapName.key${key}" from-field="value"/>
   
    <set field="key" value="${key + 1}"/>
</iterate>

This will give you direction for making your keys for map and obviously map.
Use it accordingly.

Regards
--
Chirag Manocha
HotWax Media Pvt. Ltd.
Website :- www.hotwaxmedia.com
Contact :- +91-98263-19099



On Tue, Jul 7, 2009 at 4:26 PM, SRINIKALLS <srinivas.kallumadi@cognizant.com
> wrote:

>
> Hi
>
>
>        In Minilang simple-method, is to possible to set a list value to
> map?
>
>
> Thanks & Regards
> Prashanth Jilla
> --
> View this message in context:
> http://www.nabble.com/How-to-set-list-to-map-tp24371114p24371114.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>