Hi all,
I am trying to make a computed column with the following script from the Resources page to replace blanks with zeros:
"// if you have a Table that displays a NULL value as a blank but you would prefer to display it as ZERO (0)
// the dataSetRow is going to be the value you are looking at
if ((dataSetRow[“sum Number of Juvenile Females (Observed)”]) != “NULL”)
{
** return 0;**
} "
I cannot get it to work. My question is what Data Type should I select? Or are there any other settings I need to define? I have tried most Data Types but still not working. Please help.
Many thanks,
Adam
Hi Adam
You can try this
if ((dataSetRow[“sum Number of Juvenile Females (Observed)”]) == null)
{
0;
}
else
{
(dataSetRow[“sum Number of Juvenile Females (Observed)”]
}
Other simple solution is (only work if your data type is decimal or number)
dataSetRow[“your_data_set”]+0
Regards
Lili Sadikin
1 Like
Before add (+ 0)
After add (+ 0)
Here the script
Same result if I use this script
if ((dataSetRow[“n1”]) == null)
{
0;
}
else
{
dataSetRow[“n1”]
}
Regard
Lili Sadikin
1 Like
Hi Lili,
Many thanks for your help. The mistake I was making is that I wasn’t using the new computed column in the fields, instead I used the original row data from the query - I basically forgot to replace the cells with the updated columns I created. Well, I hope at least others who want display zeros will find your code useful.
Have a great day,
Adam