You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Christian Carlow <ch...@gmail.com> on 2014/01/10 21:30:02 UTC

How to access simple-method map with integer keys

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.

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

Posted by Christian Carlow <ch...@gmail.com>.
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.


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

Posted by Christian Carlow <ch...@gmail.com>.
Thanks Adrian,

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

On 01/10/2014 02:37 PM, adrian.crum@sandglass-software.com 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 <ch...@gmail.com>:
>
>> 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.
>>
>
>
>


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

Posted by ad...@sandglass-software.com.
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 <ch...@gmail.com>:

> 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.
>