Done in http://docs.ofbiz.org/x/Hhk
Please let me know if it needs more information

Thanks

Jacques

From: "Jacques Le Roux" <jacques.le.r...@les7arts.com>
Thanks Adrian,

I will try, I have some time ahead...

Jacques

From: "Adrian Crum" <adri...@hlmksw.com>
Jacques,

I was planning on creating a wiki page for the UEL and the OFBiz extensions, but it will be a while before I have the time to do it.

If anyone would like to get one started, there was another thread where I posted a link to a JSR-245 PDF file that has the UEL syntax specification.

OFBiz adds the following extensions to the UEL:

1. ${someList[]} - appends a list element. It is converted internally to ${someList['add']} - so that syntax could be used as well.

2. ${someList[+0]} - inserts a list element at the specified index. It is converted internally to ${someList['ins...@0']} - so that syntax could be used as well.

3. OFBiz supports variable creation (auto-vivify). In the expression ${someMap.anotherMap.mapElement} if someMap or anotherMap don't exist, they are created.

4. OFBiz has a number of built-in UEL functions - http://api.ofbiz.org/org/ofbiz/base/util/string/UelFunctions.html

-Adrian


Jacques Le Roux wrote:
Adiran,

Could we have a page somewhere in the Wiki ? With links to official UEL expressions maybe, and our specificities if any. My apologies if it aready exists :o)

Jacques

From: "Adrian Crum" <adrian.c...@yahoo.com>
Brett,

In the past, the OFBiz scripting languages (screen widgets and minilang) used a home-grown expression parser that only recognized and manipulated strings. We have converted the home-grown expression parser over to the Unified Expression Language so that more powerful expressions can be used. So, you have to look at it from an expression standpoint, not a Map or database or String standpoint.

Identifiers in UEL expressions must follow Java naming conventions. Your example:

<set field="passedVal" from-field="someMap.${surveyResponseOptionAnswer.surveyOptionSeqId}"/>

which evaluates to:

<set field="passedVal" from-field="someMap.000"/>

would be similar to:

String passedVal = someObject.000;

in Java. Try creating a class property in Java named "000" - it won't let you.

The benefit of using the UEL is we can create expressions like:

<set field="extendedCost" value="${orderItem.cost * orderItem.quantity}"/>

which is something we couldn't do before.

-Adrian


--- On Tue, 1/20/09, Brett Palmer <brettgpal...@gmail.com> wrote:

From: Brett Palmer <brettgpal...@gmail.com>
Subject: Re: New Syntax to preserve String for 000 value using FlexibleString expander
To: dev@ofbiz.apache.org
Date: Tuesday, January 20, 2009, 9:47 PM
Adrian,

Thanks for the reply.

Is there a reason we default to converting from a String to
a Long?  The
example I gave is reading records from a VARCHAR field in a
database.  It
seems like that should be a String be default.  I'm
probably not
understanding the benefit for the automatic cast.


Brett

On Tue, Jan 20, 2009 at 12:06 PM, Adrian Crum
<adri...@hlmksw.com> wrote:

> Try
>
> <Set field="passedVal">
>
from-field="someMap._${surveyResponseOptionAnswer.surveyOptionSeqId}"/>
>
> or
>
> <Set field="passedVal">
from-field="someMap["_" +
>
surveyResponseOptionAnswer.surveyOptionSeqId]"/>
>
> The idea is to make the key something other than
numeric.
>
> If keys like "_000" cause a problem
elsewhere in the code, then try
>
> <Set field="passedVal">
>
from-field="someMap[str:toString(surveyResponseOptionAnswer.surveyOptionSeqId)]"/>
>
> -Adrian
>
>
>
> Brett Palmer wrote:
>
>> Here is an example:
>>
>> <Set field="passedVal"
>>
from-field="someMap.${surveyResponseOptionAnswer.surveyOptionSeqId}"
>> />
>>
>>
>> Where surveyOptionSeqId is 000 but translates to
0.  Then doesn't
>> match the key value in the map.
>>
>> Brett
>>
>>
>> On 1/20/09, Adrian Crum <adri...@hlmksw.com>
wrote:
>>
>>> Brett,
>>>
>>> Could you provide a code snippet?
>>>
>>> -Adrian
>>>
>>> Brett Palmer wrote:
>>>
>>>> I saw some posts on this earlier but not
sure of the exact syntax.  We
>>>> have
>>>> some SimpleMethod that use index keys like
"000", "001", etc.  This are
>>>> being converted to longs and no longer
work in our Maps.  What is the
>>>> SimpleMethod syntax to preserve the String
value "000" instead of
>>>> changes
>>>> to
>>>> a long.
>>>>
>>>>
>>>> Brett
>>>>
>>>>
>>








Reply via email to