This is a migrated thread and some comments may be shown as answers.

I want a field to display "None" when it has no value

5 Answers 331 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Sadie
Top achievements
Rank 1
Sadie asked on 30 Sep 2014, 11:11 PM
Is there a way to cause a data field to display the string "None" when the field has no value?  Otherwise the field should display its appropriate value.  

I was trying to use a combination of the IIF() and ISNULL() functions like this for the field's Value property

= IIf(IsNull(Fields.AccountCode),"None", Fields.AccountCode)

but I was getting errors that said:

An error has occurred while processing TextBox 'textBox17':
Type mismatch in function arguments. Cannot find an overload of the function IsNull() that accepts arguments of type (String).


Thank you.  Any help would be most appreciated.  I am still very new to coding.

5 Answers, 1 is accepted

Sort by
0
Ben
Top achievements
Rank 1
answered on 01 Oct 2014, 12:32 AM
have you considered moving the condition to your query data source or is that an option? ie :

'select ISNULL(column, 'NONE') as columnA from table'
0
Sadie
Top achievements
Rank 1
answered on 01 Oct 2014, 12:43 AM
I don't think that is an option as I need to be able to view all of the data; even where some fields are empty.  For aesthetic reasons I'd like to fill in the empty fields with placeholder text, but if I can't do that it is ok.

Thank you for the reply though.
0
Sadie
Top achievements
Rank 1
answered on 01 Oct 2014, 12:49 AM
Wait, I'm sorry. I'm very new to SQL. I was thinking that you meant to remove the Nulls from the dataset. Could you please explain to me what the SQL you used is meant to do? Does it replace Null values with the string 'None'?  Thanks so much.
0
Ben
Top achievements
Rank 1
answered on 01 Oct 2014, 12:52 AM
yes it replaces the values.
0
Sadie
Top achievements
Rank 1
answered on 01 Oct 2014, 12:57 AM
I will try that. Thank you.
Tags
Report Designer (standalone)
Asked by
Sadie
Top achievements
Rank 1
Answers by
Ben
Top achievements
Rank 1
Sadie
Top achievements
Rank 1
Share this question
or