Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Empty value for a Date-DataType
Lea
Hi there,<br />
<br />
I have a design that contains a columns with the datatype "Date". Now it might happen, that this value is null or empty during the fetch event. The report stops then and shows an error message: <br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>Error.ReportQueryLoadingError2 ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: Can not load the report query: 73. Errors occurred when generating the report document for the report element with ID 73. (Element ID:73)
</pre>
<br />
What do I have to do to avoid this? I tried to return something like "Jan 01, 1980 00:00 PM", when I know that there is an empty value. That works, but that will obviously falsify the results. It would be the best to leave it empty. But how?<br />
<br />
Thanks.
Find more posts tagged with
Comments
JasonW
Nulls should work for dates. One thing to try is to put a filter on the dataset to filter out nulls or blanks.
Jason
Lea
<blockquote class='ipsBlockquote' data-author="'JasonW'" data-cid="100109" data-time="1336493153" data-date="08 May 2012 - 09:05 AM"><p>
Nulls should work for dates. One thing to try is to put a filter on the dataset to filter out nulls or blanks.<br />
<br />
Jason<br /></p></blockquote>
<br />
Thanks for your reply. What do you mean by "Nulls"? You mean "null" (as a string) or null (as an "object"). I think I tried all of this anyway. I also tried 0 and "0". All with the same result.
Hans_vd
Is the date value used in a script or expression in your report?
Or is the date column used in the WHERE clause of your query?
Lea
This is how it's used within the fetch-Script in a DataSet:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
var v = myClass.getDateValue();
row["MyCol"] = v;
</pre>
<br />
MyCol is one of the output columns, with the type "Date"
CBR
if myClass is null your code will throw a nullpointer exception and prevent the report from beeing generated.<br />
<br />
Can you try to modify the code to:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
var v = myClass;
if(myClass!=null) {
v = myClass.getDateValue();
}
row["MyCol"] = v;
</pre>
Lea
<blockquote class='ipsBlockquote' data-author="'cbrell'" data-cid="100143" data-time="1336568372" data-date="09 May 2012 - 05:59 AM"><p>
if myClass is null your code will throw a nullpointer exception and prevent the report from beeing generated.<br /></p></blockquote>
<br />
Of course, but that is not the problem. MyClass is never null. But the return value of myClass.getDateValue() might be null or empty or whatever BIRT wants me to be it. I simply need to know what to return here in this method "myClass.getDateValue()" when I do not have a date.
CBR
Oh i see. You should be able to set the corresponding to null (this is what you should)
Are you able to provide the full stack trace that belongs to that error message? It should be in a log file or below report in HTML format.
What's your BIRT version?
Lea
Mmmh, I tried again to return null, now it worked. Strange, but thanks to all of you.