Four Js Development Tools Forum

Discussions by product => Reporting tools (GRW, GRE) => Topic started by: Paul M. on July 17, 2014, 09:27:06 am



Title: Date Formating - Error when null
Post by: Paul M. on July 17, 2014, 09:27:06 am
Any suggestions on how to stop this error when I have a null date:

Code
  1. Premature end of file
  2. 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
  1. <Item name="pr_header.date_deliver" type="DATE" isNull="1" value="          " isoValue="          " caption="Date Deliver"/>

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




Thanks.


Using Genero 2.50


Title: Re: Date Formating - Error when null
Post by: Romain W. on July 18, 2014, 03:54:46 pm
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


Title: Re: Date Formating - Error when null
Post by: Paul M. on July 29, 2014, 12:50:50 pm
Thanks Romain.

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