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)
Default value for a number field
Tinwolf
This is probably very simple and I apologise if it is but I`ve not found an answer for this.
I`ve created a report to be used for stock taking, the report will be used for people to go around and enter a count value against the items displayed on the report. I also want the report to show a count value if the item has already been counted and entered in the system.
I have the report to include the count value field and this field shows 0.00 (currency formatted) if the item hasn`t been counted yet. Is there a way of having this field display a null value if it hasn`t been counted?
I can`t make it invisible if it`s 0.00 as that could be the amount that`s been counted and entered.
Find more posts tagged with
Comments
kclark
Sorry this got missed, you could create a computed column for this depending on how you're checking to see if the item has been counted. You could use an expression similar to this<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if(vars["isCounted"] == "True") {
row["QTY"]
} else {
"Null"
}
</pre>
<br />
How are you getting if it has been counted? If it's in the DB then the above code should work with minimal modification, you could do something like<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if(row["HASBEENCOUNTED"] == "True") {
row["QTY"]
} else {
"Null"
}
</pre>
Tinwolf
Thanks for the reply K.
We know if something`s been counted because it has a value in the countquantity field which is the field that at the moment shows 0.00 if it doesn`t have a value.
So I need something that checks if the field is null perhaps?
kclark
Tinwolf, take a look at the report I just attached, I think it'll do what you need. I created a csv data source where items that haven't been counted have no value. I the created a computed column checking if it is null or not. I then gave the computed column a value like 9999999 if it equals null or passed the count to it if it didn't. In my table I dragged the computed column in a cell with a dynamic text and made the column invisible. The code for the dynamic text looks like this.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if(row["checkCount"] == 99999999) {
this.value = "Not counted";
} else {
this.value = row["checkCount"];
}
</pre>
<br />
This way you can still aggregate on the computed column if needed. Let me know if this helps or if I need to adjust it more for your needs.
Tinwolf
Hi K
I really appreciate the work you`ve put into this for me, I`ll certainly work with your suggestions and see how it goes.
Thanks again.