Date Formating - Error when null

Started by Paul M., July 17, 2014, 09:27:06 AM

Previous topic - Next topic

Paul M.

Any suggestions on how to stop this error when I have a null date:

Code (java) Select
Premature end of file
Cause:(GS-33927) Expression error: (GS-33936) Error executing RTL method "fromIsoValue" on object of type java.util.Date (cause=(GS-33968) Date.parseString(): Failed to parse date value "          " with pattern "YYYY-MM-DD") evaluating RTL expression "{Date.fromIsoValue(pr_header.date_deliver.isoValue).format("DD MMM YYYY")}"



Code (xml) Select
<Item name="pr_header.date_deliver" type="DATE" isNull="1" value="          " isoValue="          " caption="Date Deliver"/>

My dates are formatted as
Code (java) Select
Date.fromIsoValue(pr_header.date_deliver.isoValue).format("DD MMM YYYY")




Thanks.


Using Genero 2.50

Romain W.

Hi Paul,

Try the following expression, that should work:
pr_header.date_deliver.isoValue.trim().isEmpty()?"<replacement_string>":Date.fromIsoValue(pr_header.date_deliver.isoValue).format("DD MMM YYYY"),
where <replacement_string> is a string of your choice (can be empty).

But normally, since version 2.50, you should be able to test the value of the variable with the 'isNull()' RTL function, but it doesn't seem to work (I made several tests on that, but always got the same error); we'll investigate on that.

Best regards,
Romain

Paul M.

Thanks Romain.

I was trying the isnull() but it didn't seem to work so I thought I was doing something wrong.