Home
Analytics
Display Custom String when empty data set
guru520
I am using the Eclipse SDK and BIRT plug in?I believe
In Help says: Birt 2.2.2 in the Eclipse SDK 3.3.2
I want to check a sum data field for null, if it is null, I want to display $0.00.
The calculated fields portion of the data set, I believe, checks for empty data set and does not evaluate the expression stored? So I cant check for null against the record set.
So something like :
if(dataSetRow[?SumField?] == null)
{?$0.00?}
Else
{dataSetRow[?SumField?]}
Or something like this : I want to actually check the summed field for null, and display a custom string of ?$0.00? if null.
In the Edit Data Set Dialog Box, Computed columns such as a sum field, if the data set is empty it does not seem to evaluate the expression defined? How do you get BIRT to evaluate the expression when the data set returns empty and skips the expression?
Find more posts tagged with
Comments
mwilliams
Hi guru520,<br />
<br />
This post from the devShare may help.<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.com/devshare/designing-birt-reports/522-birt-display-quot-no-data-quot-when-table-is-empty-example/#description'>BIRT
Display "No Data" When Table Is Empty Example - Designs & Code - BIRT Exchange</a>
guru520
How do I refer to a specific data set. I have more than one so when I check for coundOfRows == 0 the other data set, sets this to always be true.
so say the name of my data set that I want to check is Awards, can I reference and say
if Awards.length == 0?
what is the function to return length of data set?
mwilliams
guru520,
I don't know of a function that allows you to check the size of the dataSet, however, that doesn't mean that there isn't one.
As for the countofrows == 0 check, you could have 'countofrows1', 'countofrows2', etc. in the different tables associated with the different datasets.
I'm not sure I understand your goal with this completely. You have multiple datasets and you want to display "no data" individually for them if they don't have data, or do you only want to display "no data" if all of them have no data? Or something else? Let me know.
guru520
I have maneuvered around the original empty record set:display 0 issue by using the script tutorial you mentioned. This worked well by keeping separate variables++ for each data type trying to display 0 if null.
However this only works if the 0 label is in a different cell than the cell the value would be displayed. In the issue I now have the zero label is in the same cell as the value. This has the undesirable effect of always incrementing the variable++ so the zero will never display.
I try using java script in the expression builder, but as you know, if the value is empty or null, the expression never evaluates!
BIRT desperately needs a isNull() that does evaluate in the expression builder.
BIRT's sql capabillities do not allow for aliases, the xml page will not let you back until the programmer removes all aliases from the query. Example database ds
where ds.name = somethingelse.name
in addition sql function such as var=(subquery), does not work!!!
in addition sql alias assignments such as isnull(var, 0) as Avariable shows up as a column named unnamed_1 no matter if I have AS Avariable!!!
why is this? I could have easily gotten around the problem if the SQL query isnull(checkvariable, replacement value) actually worked in BIRT, but no!!
Could you make a fix for this? And just add a global function isnull()? That the report can access at any point in the report?
If you have any useful hard code on how to display a zero when the datafield is null please please share it with me.
guru520
Could you post a solution for the use of isNull() using maybe the isNaN() function?
mwilliams
guru520,
So, you would like an example that displays $0.00 in a column when a certain value in the column is null? Or when the dataSet is empty, you want to display $0.00? Or both? I guess I'm just not 100% sure I understand your issue. Can you create a report with the sample database that shows your issue? This way I can run it and see exactly what the issue is. Also, I'll be able to modify the report design to try to help with your issue. Thanks.
rahul_earl
Now I have a different scenario here. I have multiple datasets for my report and I have to hide all the tables if any of the dataset(s) is empty. <br />
<br />
Please let me know, how to proceed with it. <br />
Thanks,<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="46647" data-time="1239981185" data-date="17 April 2009 - 08:13 AM"><p>
guru520,<br />
<br />
<br />
So, you would like an example that displays $0.00 in a column when a certain value in the column is null? Or when the dataSet is empty, you want to display $0.00? Or both? I guess I'm just not 100% sure I understand your issue. Can you create a report with the sample database that shows your issue? This way I can run it and see exactly what the issue is. Also, I'll be able to modify the report design to try to help with your issue. Thanks.<br /></p></blockquote>
mwilliams
Take a look at this devShare post, that uses the data engine api. You could check the values in your dataSet, in the beforeFactory. If there's no values returned, you can drop everything in the report.
http://www.birt-exchange.org/org/devshare/designing-birt-reports/1542-data-engine-api-to-check-data-set-values/
bpchowdary
<p>Scenario: My report contains set of parameters .If I select a parameter and dataset doesnot have data based on these parameters then i want to display custom message.</p><p> </p><p>Im using Actuate BIRT Designer Professional Version: 3.7.2</p>