list<genericValue> check for value, get value

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

list<genericValue> check for value, get value

Robert Gan
Hey,

I have a list as mentioned in the subject. This is created in the PriceServices.Java file.

My Problem is, that this list is size()=1. So all is written like 1 long string. But this string contains important information about the price rules, where I need f.ex the end-date from etc.

Do you now how I can get these data out of it? Why it is just size=1?

Normally I can use ".contains()" on lists...but with size=1 obviously it does not work.

please help me soon :)

Thanks

Robert
Reply | Threaded
Open this post in threaded view
|

Re: list<genericValue> check for value, get value

Ankit Jain-2
Use EntityUtil.getFirst(List<GenericValue> values) it will return the first
record of the list, internally it do values.get(0).

Regards,
Ankit Jain




On Fri, Jun 22, 2012 at 4:43 PM, Robert G. <[hidden email]> wrote:

> Hey,
>
> I have a list as mentioned in the subject. This is created in the
> PriceServices.Java file.
>
> My Problem is, that this list is size()=1. So all is written like 1 long
> string. But this string contains important information about the price
> rules, where I need f.ex the end-date from etc.
>
> Do you now how I can get these data out of it? Why it is just size=1?
>
> Normally I can use ".contains()" on lists...but with size=1 obviously it
> does not work.
>
> please help me soon :)
>
> Thanks
>
> Robert
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/list-genericValue-check-for-value-get-value-tp4633929.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: list<genericValue> check for value, get value

Robert Gan
Thanks for your fast reply. The problem is, that with that method I get the whole string, but I need the entity fields. My string what is printed now looks like:

[GenericEntity:ProductPriceRule][createdStamp,2012-06-20 23:37:56.898(java.sql.Timestamp)][createdTxStamp,2012-06-20 23:37:56.759(java.sql.Timestamp)][description,[10000] Panasonic PT-AX100 Projektor(java.lang.String)][fromDate,2012-06-20 23:37:56.81(java.sql.Timestamp)][isSale,Y(java.lang.String)][lastUpdatedStamp,2012-06-22 06:46:54.734(java.sql.Timestamp)][lastUpdatedTxStamp,2012-06-22 06:46:54.714(java.sql.Timestamp)][productPriceRuleId,10000(java.lang.String)][ruleName,DEAL(java.lang.String)][thruDate,2012-06-30 02:01:02.0(java.sql.Timestamp)]

from this I f.ex. wannt to extract the thruDate etc.

Do you know how to handle?

Thanks :)


Ankit Jain wrote
Use EntityUtil.getFirst(List<GenericValue> values) it will return the first
record of the list, internally it do values.get(0).

Regards,
Ankit Jain




On Fri, Jun 22, 2012 at 4:43 PM, Robert G. <[hidden email]> wrote:

> Hey,
>
> I have a list as mentioned in the subject. This is created in the
> PriceServices.Java file.
>
> My Problem is, that this list is size()=1. So all is written like 1 long
> string. But this string contains important information about the price
> rules, where I need f.ex the end-date from etc.
>
> Do you now how I can get these data out of it? Why it is just size=1?
>
> Normally I can use ".contains()" on lists...but with size=1 obviously it
> does not work.
>
> please help me soon :)
>
> Thanks
>
> Robert
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/list-genericValue-check-for-value-get-value-tp4633929.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: list<genericValue> check for value, get value

Robert Gan
Ah I got it,

I do it like this:

getFirst(...).get("thruDate")

great, thank you for your hint!