Adrian,

Thanks for the explanation.  I'll do some more reading on the unified
expression language to get caught up.


Brett

On Wed, Jan 21, 2009 at 7:21 AM, Adrian Crum <adrian.c...@yahoo.com> wrote:

> 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