You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by varun bhansaly <vb...@gmail.com> on 2010/06/18 18:23:52 UTC

groovy screen widget

Hi,
I am using ofbiz 09.04, facing an issue with groovy & screen widget.
my screen widget action contains -
<set field="*andCondition*" value="*${groovy: return
org.ofbiz.entity.condition.EntityCondition.makeCondition("isVirtual", "Y")}*
" />
In my groovy script *andCondition *is an instanceof *String* (isVirtual = Y)
instead of *EntityCondition*.

*What could be possibly wrong, am i missing something ?
*
-- 
Regards,
Varun Bhansaly

Re: groovy screen widget

Posted by Scott Gray <sc...@hotwaxmedia.com>.
What are there asterisks everywhere in your code?
Why aren't you just creating the condition in groovy?

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 19/06/2010, at 4:23 AM, varun bhansaly wrote:

> Hi,
> I am using ofbiz 09.04, facing an issue with groovy & screen widget.
> my screen widget action contains -
> <set field="*andCondition*" value="*${groovy: return
> org.ofbiz.entity.condition.EntityCondition.makeCondition("isVirtual", "Y")}*
> " />
> In my groovy script *andCondition *is an instanceof *String* (isVirtual = Y)
> instead of *EntityCondition*.
> 
> *What could be possibly wrong, am i missing something ?
> *
> -- 
> Regards,
> Varun Bhansaly


Re: groovy screen widget

Posted by james_sg <sn...@hotmail.com>.
Hi Jacques,

I am sorry that I couldn't get the time for making a patch.

Those interested may want to start looking at htmlTemplate.ftl and trace
from there.

Regards,
James


Jacques Le Roux wrote:
> 
> Hi James,
> 
> Did you succeed with this backporting? 
> If yes you might coinsider to contribute a patch even if it will not be
> commited (only bugs)
> I'm quite sure a number of persons would appreciate...
> 
> Thanks
> 
> Jacques
> 
> From: "james_sg" <sn...@hotmail.com>
>> 
>> Hi Scott,
>> 
>> I agree. In my special case, I was backporting the ajax lookup code from
>> 10.04 to 9.04, and encountered the problem where the "set field" function
>> gives a String instead of the EntityCondition object. So if I were to use
>> the makeCondition function, many extra groovy files will be created.
>> 
>> Regards,
>> James
>> 
>> 
>> Scott Gray-2 wrote:
>>> 
>>> I would argue that using groovy is the right approach regardless of the
>>> version.  Screen actions are intended to speed up simple tasks, they are
>>> not a substitute for actual scripting.  Especially when you consider
>>> that
>>> whenever you try and do something complicated with them you end up
>>> spending more time debugging than if you had just put your logic in a
>>> script in the first place.
>>> 
>>> Regards
>>> Scott
>>> 
>>> On 21/06/2010, at 6:24 PM, james_sg wrote:
>>> 
>>>> 
>>>> Hi Varun,
>>>> 
>>>> What you had wanted to do will work if you are using 10.04.
>>>> So coding it in groovy file is the right approach when using 9.04
>>>> 
>>>> Regards,
>>>> James
>>>> 
>>>> 
>>>> Hi Scott,
>>>> I have already put the groovy part in a .groovy file, though just
>>>> wanted
>>>> to
>>>> know if i had missed something.
>>>> Thanks again.
>>>> 
>>>> On Sat, Jun 19, 2010 at 12:56 PM, varun bhansaly
>>>> <vb...@gmail.com>wrote:
>>>> 
>>>>> Hi Atul,
>>>>> Thanks for ur reply.
>>>>> I had already tried that with type = "Object", it still does not work,
>>>>> still seen as instanceof String.
>>>>> 
>>>>> Hi Scott,
>>>>> There are no asterisks, for the post i had replaced &quot; with ".
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> -- 
>>>> View this message in context:
>>>> http://ofbiz.135035.n4.nabble.com/groovy-screen-widget-tp2260470p2262179.html
>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>> 
>>> 
>>>  
>>> 
>> 
>> -- 
>> View this message in context:
>> http://ofbiz.135035.n4.nabble.com/groovy-screen-widget-tp2260470p2262209.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
> 
> 
> 

-- 
View this message in context: http://ofbiz.135035.n4.nabble.com/groovy-screen-widget-tp2260470p2262328.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: groovy screen widget

Posted by Jacques Le Roux <ja...@les7arts.com>.
Hi James,

Did you succeed with this backporting? 
If yes you might coinsider to contribute a patch even if it will not be commited (only bugs)
I'm quite sure a number of persons would appreciate...

Thanks

Jacques

From: "james_sg" <sn...@hotmail.com>
> 
> Hi Scott,
> 
> I agree. In my special case, I was backporting the ajax lookup code from
> 10.04 to 9.04, and encountered the problem where the "set field" function
> gives a String instead of the EntityCondition object. So if I were to use
> the makeCondition function, many extra groovy files will be created.
> 
> Regards,
> James
> 
> 
> Scott Gray-2 wrote:
>> 
>> I would argue that using groovy is the right approach regardless of the
>> version.  Screen actions are intended to speed up simple tasks, they are
>> not a substitute for actual scripting.  Especially when you consider that
>> whenever you try and do something complicated with them you end up
>> spending more time debugging than if you had just put your logic in a
>> script in the first place.
>> 
>> Regards
>> Scott
>> 
>> On 21/06/2010, at 6:24 PM, james_sg wrote:
>> 
>>> 
>>> Hi Varun,
>>> 
>>> What you had wanted to do will work if you are using 10.04.
>>> So coding it in groovy file is the right approach when using 9.04
>>> 
>>> Regards,
>>> James
>>> 
>>> 
>>> Hi Scott,
>>> I have already put the groovy part in a .groovy file, though just wanted
>>> to
>>> know if i had missed something.
>>> Thanks again.
>>> 
>>> On Sat, Jun 19, 2010 at 12:56 PM, varun bhansaly
>>> <vb...@gmail.com>wrote:
>>> 
>>>> Hi Atul,
>>>> Thanks for ur reply.
>>>> I had already tried that with type = "Object", it still does not work,
>>>> still seen as instanceof String.
>>>> 
>>>> Hi Scott,
>>>> There are no asterisks, for the post i had replaced &quot; with ".
>>>> 
>>>> 
>>>> 
>>> 
>>> -- 
>>> View this message in context:
>>> http://ofbiz.135035.n4.nabble.com/groovy-screen-widget-tp2260470p2262179.html
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>> 
>> 
>>  
>> 
> 
> -- 
> View this message in context: http://ofbiz.135035.n4.nabble.com/groovy-screen-widget-tp2260470p2262209.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>


Re: groovy screen widget

Posted by varun bhansaly <vb...@gmail.com>.
Hi James,
This is exactly the same reason why i posted this in first place wen i was
backporting ajax autocomplete (successfully).
but I do agree with Scott as well.
Thanks.

On Mon, Jun 21, 2010 at 12:38 PM, james_sg <sn...@hotmail.com> wrote:

>
> Hi Scott,
>
> I agree. In my special case, I was backporting the ajax lookup code from
> 10.04 to 9.04, and encountered the problem where the "set field" function
> gives a String instead of the EntityCondition object. So if I were to use
> the makeCondition function, many extra groovy files will be created.
>
> Regards,
> James
>
>
> Scott Gray-2 wrote:
> >
> > I would argue that using groovy is the right approach regardless of the
> > version.  Screen actions are intended to speed up simple tasks, they are
> > not a substitute for actual scripting.  Especially when you consider that
> > whenever you try and do something complicated with them you end up
> > spending more time debugging than if you had just put your logic in a
> > script in the first place.
> >
> > Regards
> > Scott
> >
> > On 21/06/2010, at 6:24 PM, james_sg wrote:
> >
> >>
> >> Hi Varun,
> >>
> >> What you had wanted to do will work if you are using 10.04.
> >> So coding it in groovy file is the right approach when using 9.04
> >>
> >> Regards,
> >> James
> >>
> >>
> >> Hi Scott,
> >> I have already put the groovy part in a .groovy file, though just wanted
> >> to
> >> know if i had missed something.
> >> Thanks again.
> >>
> >> On Sat, Jun 19, 2010 at 12:56 PM, varun bhansaly
> >> <vb...@gmail.com>wrote:
> >>
> >>> Hi Atul,
> >>> Thanks for ur reply.
> >>> I had already tried that with type = "Object", it still does not work,
> >>> still seen as instanceof String.
> >>>
> >>> Hi Scott,
> >>> There are no asterisks, for the post i had replaced " with ".
> >>>
> >>>
> >>>
> >>
> >> --
> >> View this message in context:
> >>
> http://ofbiz.135035.n4.nabble.com/groovy-screen-widget-tp2260470p2262179.html
> >> Sent from the OFBiz - User mailing list archive at Nabble.com.
> >
> >
> >
> >
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/groovy-screen-widget-tp2260470p2262209.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>



-- 
Regards,
Varun Bhansaly

Re: groovy screen widget

Posted by james_sg <sn...@hotmail.com>.
Hi Scott,

I agree. In my special case, I was backporting the ajax lookup code from
10.04 to 9.04, and encountered the problem where the "set field" function
gives a String instead of the EntityCondition object. So if I were to use
the makeCondition function, many extra groovy files will be created.

Regards,
James


Scott Gray-2 wrote:
> 
> I would argue that using groovy is the right approach regardless of the
> version.  Screen actions are intended to speed up simple tasks, they are
> not a substitute for actual scripting.  Especially when you consider that
> whenever you try and do something complicated with them you end up
> spending more time debugging than if you had just put your logic in a
> script in the first place.
> 
> Regards
> Scott
> 
> On 21/06/2010, at 6:24 PM, james_sg wrote:
> 
>> 
>> Hi Varun,
>> 
>> What you had wanted to do will work if you are using 10.04.
>> So coding it in groovy file is the right approach when using 9.04
>> 
>> Regards,
>> James
>> 
>> 
>> Hi Scott,
>> I have already put the groovy part in a .groovy file, though just wanted
>> to
>> know if i had missed something.
>> Thanks again.
>> 
>> On Sat, Jun 19, 2010 at 12:56 PM, varun bhansaly
>> <vb...@gmail.com>wrote:
>> 
>>> Hi Atul,
>>> Thanks for ur reply.
>>> I had already tried that with type = "Object", it still does not work,
>>> still seen as instanceof String.
>>> 
>>> Hi Scott,
>>> There are no asterisks, for the post i had replaced &quot; with ".
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://ofbiz.135035.n4.nabble.com/groovy-screen-widget-tp2260470p2262179.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
> 
> 
>  
> 

-- 
View this message in context: http://ofbiz.135035.n4.nabble.com/groovy-screen-widget-tp2260470p2262209.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: groovy screen widget

Posted by Scott Gray <sc...@hotwaxmedia.com>.
I would argue that using groovy is the right approach regardless of the version.  Screen actions are intended to speed up simple tasks, they are not a substitute for actual scripting.  Especially when you consider that whenever you try and do something complicated with them you end up spending more time debugging than if you had just put your logic in a script in the first place.

Regards
Scott

On 21/06/2010, at 6:24 PM, james_sg wrote:

> 
> Hi Varun,
> 
> What you had wanted to do will work if you are using 10.04.
> So coding it in groovy file is the right approach when using 9.04
> 
> Regards,
> James
> 
> 
> Hi Scott,
> I have already put the groovy part in a .groovy file, though just wanted to
> know if i had missed something.
> Thanks again.
> 
> On Sat, Jun 19, 2010 at 12:56 PM, varun bhansaly <vb...@gmail.com>wrote:
> 
>> Hi Atul,
>> Thanks for ur reply.
>> I had already tried that with type = "Object", it still does not work,
>> still seen as instanceof String.
>> 
>> Hi Scott,
>> There are no asterisks, for the post i had replaced &quot; with ".
>> 
>> 
>> 
> 
> -- 
> View this message in context: http://ofbiz.135035.n4.nabble.com/groovy-screen-widget-tp2260470p2262179.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: groovy screen widget

Posted by james_sg <sn...@hotmail.com>.
Hi Varun,

What you had wanted to do will work if you are using 10.04.
So coding it in groovy file is the right approach when using 9.04

Regards,
James


Hi Scott,
I have already put the groovy part in a .groovy file, though just wanted to
know if i had missed something.
Thanks again.

On Sat, Jun 19, 2010 at 12:56 PM, varun bhansaly <vb...@gmail.com>wrote:

> Hi Atul,
> Thanks for ur reply.
> I had already tried that with type = "Object", it still does not work,
> still seen as instanceof String.
>
> Hi Scott,
> There are no asterisks, for the post i had replaced &quot; with ".
>
>
>

-- 
View this message in context: http://ofbiz.135035.n4.nabble.com/groovy-screen-widget-tp2260470p2262179.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: groovy screen widget

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Hi Varun,

But I don't understand why you don't just create the entity condition in the groovy file:
isVirtualCondition = org.ofbiz.entity.condition.EntityCondition.makeCondition("isVirtual", "Y")

Why try and create a condition in the screen widget when it is easier to do it in the groovy file itself?

Regards
Scott

On 19/06/2010, at 7:29 PM, varun bhansaly wrote:

> Hi Scott,
> I have already put the groovy part in a .groovy file, though just wanted to
> know if i had missed something.
> Thanks again.
> 
> On Sat, Jun 19, 2010 at 12:56 PM, varun bhansaly <vb...@gmail.com>wrote:
> 
>> Hi Atul,
>> Thanks for ur reply.
>> I had already tried that with type = "Object", it still does not work,
>> still seen as instanceof String.
>> 
>> Hi Scott,
>> There are no asterisks, for the post i had replaced &quot; with ".
>> 
>> 
>> 
>> On Sat, Jun 19, 2010 at 10:08 AM, Atul Vani <at...@hotwaxmedia.com>wrote:
>> 
>>> hi Varun,
>>> 
>>> try using 'type' attribute
>>> <set field="foo" value="${groovy: ...}" type="..."/>
>>> 
>>> --
>>> Thanks & Regards
>>> Atul Vani
>>> Enterprise Software Developer
>>> HotWax Media Pvt. Ltd.
>>> http://www.hotwaxmedia.com/
>>> We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for
>>> yourself.
>>> 
>>> 
>>> varun bhansaly wrote:
>>> 
>>>> Hi,
>>>> I am using ofbiz 09.04, facing an issue with groovy & screen widget.
>>>> my screen widget action contains -
>>>> <set field="*andCondition*" value="*${groovy: return
>>>> org.ofbiz.entity.condition.EntityCondition.makeCondition("isVirtual",
>>>> "Y")}*
>>>> " />
>>>> In my groovy script *andCondition *is an instanceof *String* (isVirtual =
>>>> Y)
>>>> instead of *EntityCondition*.
>>>> 
>>>> *What could be possibly wrong, am i missing something ?
>>>> *
>>>> 
>>>> 
>>> 
>> 
>> 
>> --
>> Regards,
>> Varun Bhansaly
>> 
> 
> 
> 
> -- 
> Regards,
> Varun Bhansaly


Re: groovy screen widget

Posted by varun bhansaly <vb...@gmail.com>.
Hi Scott,
I have already put the groovy part in a .groovy file, though just wanted to
know if i had missed something.
Thanks again.

On Sat, Jun 19, 2010 at 12:56 PM, varun bhansaly <vb...@gmail.com>wrote:

> Hi Atul,
> Thanks for ur reply.
> I had already tried that with type = "Object", it still does not work,
> still seen as instanceof String.
>
> Hi Scott,
> There are no asterisks, for the post i had replaced &quot; with ".
>
>
>
> On Sat, Jun 19, 2010 at 10:08 AM, Atul Vani <at...@hotwaxmedia.com>wrote:
>
>> hi Varun,
>>
>> try using 'type' attribute
>> <set field="foo" value="${groovy: ...}" type="..."/>
>>
>> --
>> Thanks & Regards
>> Atul Vani
>> Enterprise Software Developer
>> HotWax Media Pvt. Ltd.
>> http://www.hotwaxmedia.com/
>> We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for
>> yourself.
>>
>>
>> varun bhansaly wrote:
>>
>>> Hi,
>>> I am using ofbiz 09.04, facing an issue with groovy & screen widget.
>>> my screen widget action contains -
>>> <set field="*andCondition*" value="*${groovy: return
>>> org.ofbiz.entity.condition.EntityCondition.makeCondition("isVirtual",
>>> "Y")}*
>>> " />
>>> In my groovy script *andCondition *is an instanceof *String* (isVirtual =
>>> Y)
>>> instead of *EntityCondition*.
>>>
>>> *What could be possibly wrong, am i missing something ?
>>> *
>>>
>>>
>>
>
>
> --
> Regards,
> Varun Bhansaly
>



-- 
Regards,
Varun Bhansaly

Re: groovy screen widget

Posted by varun bhansaly <vb...@gmail.com>.
Hi Atul,
Thanks for ur reply.
I had already tried that with type = "Object", it still does not work, still
seen as instanceof String.

Hi Scott,
There are no asterisks, for the post i had replaced &quot; with ".


On Sat, Jun 19, 2010 at 10:08 AM, Atul Vani <at...@hotwaxmedia.com>wrote:

> hi Varun,
>
> try using 'type' attribute
> <set field="foo" value="${groovy: ...}" type="..."/>
>
> --
> Thanks & Regards
> Atul Vani
> Enterprise Software Developer
> HotWax Media Pvt. Ltd.
> http://www.hotwaxmedia.com/
> We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for
> yourself.
>
>
> varun bhansaly wrote:
>
>> Hi,
>> I am using ofbiz 09.04, facing an issue with groovy & screen widget.
>> my screen widget action contains -
>> <set field="*andCondition*" value="*${groovy: return
>> org.ofbiz.entity.condition.EntityCondition.makeCondition("isVirtual",
>> "Y")}*
>> " />
>> In my groovy script *andCondition *is an instanceof *String* (isVirtual =
>> Y)
>> instead of *EntityCondition*.
>>
>> *What could be possibly wrong, am i missing something ?
>> *
>>
>>
>


-- 
Regards,
Varun Bhansaly

Re: groovy screen widget

Posted by Atul Vani <at...@hotwaxmedia.com>.
hi Varun,

try using 'type' attribute
<set field="foo" value="${groovy: ...}" type="..."/>

-- 
Thanks & Regards
Atul Vani
Enterprise Software Developer
HotWax Media Pvt. Ltd.
http://www.hotwaxmedia.com/
We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for yourself.


varun bhansaly wrote:
> Hi,
> I am using ofbiz 09.04, facing an issue with groovy & screen widget.
> my screen widget action contains -
> <set field="*andCondition*" value="*${groovy: return
> org.ofbiz.entity.condition.EntityCondition.makeCondition("isVirtual", "Y")}*
> " />
> In my groovy script *andCondition *is an instanceof *String* (isVirtual = Y)
> instead of *EntityCondition*.
>
> *What could be possibly wrong, am i missing something ?
> *
>