Need help with groovy and ftl

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

Need help with groovy and ftl

rohit
Hi,

I am doing a query in orderview.groovy as follows, where i am getting a retreiving a order from a table amazonfps:

    amazonOrder = delegator.findByAnd("Amazonfps", [orderId : orderId]);
    context.amazonOrders = amazonOrder.orderId;

Now, when i use the context amazonOrders, in the orderview.ftl, the orderID retreived in enclosed in square brackets eg. [CO10652], which i am unable to get rid off. I cannot use the data in this format and have to remove the square brackets.

I am not sure what and where the issue is. Any help will be appreciated.

Thanks

Rohit
Reply | Threaded
Open this post in threaded view
|

Re: Need help with groovy and ftl

Arun Patidar
Hello Rohit,

findByAnd return list of Generic Values. So you must iterate the list,
even though it have only one record. After that you fetch the orderId

Thanks
--
AP


rohit2006 wrote:

> Hi,
>
> I am doing a query in orderview.groovy as follows, where i am getting a
> retreiving a order from a table amazonfps:
>
>     amazonOrder = delegator.findByAnd("Amazonfps", [orderId : orderId]);
>     context.amazonOrders = amazonOrder.orderId;
>
> Now, when i use the context amazonOrders, in the orderview.ftl, the orderID
> retreived in enclosed in square brackets eg. [CO10652], which i am unable to
> get rid off. I cannot use the data in this format and have to remove the
> square brackets.
>
> I am not sure what and where the issue is. Any help will be appreciated.
>
> Thanks
>
> Rohit
>
>  

Reply | Threaded
Open this post in threaded view
|

Re: Need help with groovy and ftl

rohit
Hi Arun,

Thanks so much, I knew the value returned was a Generic Value, but did not know that it had to be iterated. Now it works fine after putting it in a list.

Thanks a lot for the help.

Rohit

Arun Patidar wrote
Hello Rohit,

findByAnd return list of Generic Values. So you must iterate the list,
even though it have only one record. After that you fetch the orderId

Thanks
--
AP


rohit2006 wrote:
> Hi,
>
> I am doing a query in orderview.groovy as follows, where i am getting a
> retreiving a order from a table amazonfps:
>
>     amazonOrder = delegator.findByAnd("Amazonfps", [orderId : orderId]);
>     context.amazonOrders = amazonOrder.orderId;
>
> Now, when i use the context amazonOrders, in the orderview.ftl, the orderID
> retreived in enclosed in square brackets eg. [CO10652], which i am unable to
> get rid off. I cannot use the data in this format and have to remove the
> square brackets.
>
> I am not sure what and where the issue is. Any help will be appreciated.
>
> Thanks
>
> Rohit
>
>