Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
need 'NO DATA' text field returned in detail section when no info present
BIRTed T
I need help figuring out how to display a text field when the report returns no data. This is apparently a requirement from the Gaming Control Board here in Nevada.
In Crystal you just moved the text field to the back and it was there all the time; when no data showed up, that's when you'd see my text file 'NO DATA AVAILABLE.'
Thanks for any help!
Travis
Find more posts tagged with
Comments
kevinshih
Hi Travis,
What I did was have 2 grids in my report. The first grid had a table that would print out all the data results. The second grid only had a text label that said "No Data Found".
I added a computed column on the dataset that would count the number of records in the dataset. I then used that value to check what the count of records was. If the dataset returned 0 records, I would hide the first grid and show the second. If the dataset returned records, I would show the first grid and hide the second.
The script I used to check and set visibility is:
if (row["recordCount"] != null) {
true
}
else {
false
}
Notice that I check for null versus an actual count. If no records are returned, the recordCount never gets set, so when I ask for it, it comes back null. Otherwise, the value would be the count of records.
Hope that helps.
mwilliams
You could also do this by incrementing a variable in your onFetch method of your dataSet. If it gets incremented, there is a row, if not, you can hide what you need and show a "no data" label in its place. Either way will work!
BIRTed T
That's truly awesome... thanks for the help!
BIRTed T
<blockquote class='ipsBlockquote' data-author="'kevinshih'" data-cid="72196" data-time="1294856595" data-date="12 January 2011 - 11:23 AM"><p>
Hi Travis,<br />
<br />
What I did was have 2 grids in my report. The first grid had a table that would print out all the data results. The second grid only had a text label that said "No Data Found".<br />
<br />
I added a computed column on the dataset that would count the number of records in the dataset. I then used that value to check what the count of records was. If the dataset returned 0 records, I would hide the first grid and show the second. If the dataset returned records, I would show the first grid and hide the second.<br />
<br />
The script I used to check and set visibility is:<br />
<br />
if (row["recordCount"] != null) {<br />
true<br />
}<br />
else {<br />
false<br />
}<br />
<br />
Notice that I check for null versus an actual count. If no records are returned, the recordCount never gets set, so when I ask for it, it comes back null. Otherwise, the value would be the count of records.<br />
<br />
Hope that helps.<br /></p></blockquote>
<br />
<br />
That sounds like exactly what I need!... are you using a formula for "recordCount" or is that a field in your dataset?<br />
<br />
Thanks for your help<br />
Trav
mwilliams
Trav,
In the way described by Kevin, "record count" is the computed column in his dataSet that he would have most likely made by using the "RUNNINGCOUNT" aggregation. Then, he checks that value in visibility statements to know which items to show/hide.
BIRTed T
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="72219" data-time="1294870662" data-date="12 January 2011 - 03:17 PM"><p>
Trav,<br />
<br />
In the way described by Kevin, "record count" is the computed column in his dataSet that he would have most likely made by using the "RUNNINGCOUNT" aggregation. Then, he checks that value in visibility statements to know which items to show/hide.<br /></p></blockquote>
<br />
<br />
54 reports later, I'm now complete... thanks again for your help!<br />
<br />
Travis
mwilliams
Not a problem. Let us know whenever you have questions!