How to access simple-method map with integer keys

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

How to access simple-method map with integer keys

Christian Carlow-OFBizzer
Does anyone know how to access simple-method maps with integer keys?

So if I have parameters = quantityFromMap={3=, 2=3, 10=, 1=1, 7=, 6=,
5=, 4=, 9=, 8=}

I'm not able to access the one of the mapped values using
${parameters.quantityFromMap.1}.

I think the problem has to do with the integer key.  I've faced this
problem in the past and ended up including the underscore before the
number indexes just so they would be considered string keys.
Reply | Threaded
Open this post in threaded view
|

Re: How to access simple-method map with integer keys

Christian Carlow-OFBizzer
This error is generated in logs:

[FlexibleStringExpander.java:725:ERROR] Error evaluating expression
${parameters.quantityFromMap.10}: javax.el.ELException: Error parsing
'${parameters.quantityFromMap.10}': syntax error at position 28,
encountered '.10', expected '}

On 01/10/2014 02:30 PM, Christian Carlow wrote:

> Does anyone know how to access simple-method maps with integer keys?
>
> So if I have parameters = quantityFromMap={3=, 2=3, 10=, 1=1, 7=, 6=,
> 5=, 4=, 9=, 8=}
>
> I'm not able to access the one of the mapped values using
> ${parameters.quantityFromMap.1}.
>
> I think the problem has to do with the integer key.  I've faced this
> problem in the past and ended up including the underscore before the
> number indexes just so they would be considered string keys.

Reply | Threaded
Open this post in threaded view
|

Re: How to access simple-method map with integer keys

Adrian Crum-3
In reply to this post by Christian Carlow-OFBizzer
https://cwiki.apache.org/confluence/display/OFBTECH/Unified+Expression+Language+(JSR-245)+in+OFBiz

See the Tips and Tricks section at the bottom.

-Adrian

Quoting Christian Carlow <[hidden email]>:

> Does anyone know how to access simple-method maps with integer keys?
>
> So if I have parameters = quantityFromMap={3=, 2=3, 10=, 1=1, 7=,  
> 6=, 5=, 4=, 9=, 8=}
>
> I'm not able to access the one of the mapped values using  
> ${parameters.quantityFromMap.1}.
>
> I think the problem has to do with the integer key.  I've faced this  
> problem in the past and ended up including the underscore before the  
> number indexes just so they would be considered string keys.
>



Reply | Threaded
Open this post in threaded view
|

Re: How to access simple-method map with integer keys

Christian Carlow-OFBizzer
Thanks Adrian,

${parameters['quantityFromMap']['1']} worked according to the doc.

On 01/10/2014 02:37 PM, [hidden email] wrote:

> https://cwiki.apache.org/confluence/display/OFBTECH/Unified+Expression+Language+(JSR-245)+in+OFBiz 
>
>
> See the Tips and Tricks section at the bottom.
>
> -Adrian
>
> Quoting Christian Carlow <[hidden email]>:
>
>> Does anyone know how to access simple-method maps with integer keys?
>>
>> So if I have parameters = quantityFromMap={3=, 2=3, 10=, 1=1, 7=, 6=,
>> 5=, 4=, 9=, 8=}
>>
>> I'm not able to access the one of the mapped values using
>> ${parameters.quantityFromMap.1}.
>>
>> I think the problem has to do with the integer key.  I've faced this
>> problem in the past and ended up including the underscore before the
>> number indexes just so they would be considered string keys.
>>
>
>
>