Hey All,
I have a text field that I need to format as a date. Sometimes this field is null, in which case, I can just display an empty value.
I'd like to be able to do this:
=IIf(IsNull(ESR_UDF116, "") = "", "", IIf(Len(ESR_UDF116)=8, Substr(ESR_UDF116,4,2) + "/" + Substr(ESR_UDF116,6,2) + "/" + Substr(ESR_UDF116,0,4),""))
The logic being, if the value is null, then return an empty string. If the value is not null, then do the formatting. My formatting hinges on the value being 8 characters long, so I have another embedded IIf that checks the Len of the field. And that is the problem.
Per the documentation, the functions are evaluated completely *first* and the results passed to the functions. In this case, when my field is Null, the Len function throws an error and hoses up my report.
It seems logical to me that the functions would be evaluted in precendent order so that the Len call would *never be made* if the field value is Null.
Has anyone ever achieved this desired result?
For a null, show nothing, for a non-null, show a formatted result that involves evaluating on the field itself.
I have a text field that I need to format as a date. Sometimes this field is null, in which case, I can just display an empty value.
I'd like to be able to do this:
=IIf(IsNull(ESR_UDF116, "") = "", "", IIf(Len(ESR_UDF116)=8, Substr(ESR_UDF116,4,2) + "/" + Substr(ESR_UDF116,6,2) + "/" + Substr(ESR_UDF116,0,4),""))
The logic being, if the value is null, then return an empty string. If the value is not null, then do the formatting. My formatting hinges on the value being 8 characters long, so I have another embedded IIf that checks the Len of the field. And that is the problem.
Per the documentation, the functions are evaluated completely *first* and the results passed to the functions. In this case, when my field is Null, the Len function throws an error and hoses up my report.
It seems logical to me that the functions would be evaluted in precendent order so that the Len call would *never be made* if the field value is Null.
Has anyone ever achieved this desired result?
For a null, show nothing, for a non-null, show a formatted result that involves evaluating on the field itself.