After we translate the fields to values, we pass the expression to the MSScriptControl.ScriptControlClass object. I think you want to us the isNull expression, so like below:
IIF(isNull([FIELD]),TrueValue,FalseValue)
Hi Michael,
I know this is an old post , but is it possible in the current version of Attribute Assistant to set string or numeric fields to Null, if yes then how we can simply set the field to Null ?
The only reference I could find and it didn't work with me was below, I have tried VBNull and Null in the IIF below but also didn't work :
Attribute operations - Attribute Assistant | ArcGIS Solutions
To set values as null, use an empty string:
IIF([LOCDESC]=0, "<NULL>", [LOCDESC])
IIF([LOCDESC]=0, "", [LOCDESC])
What is the log file reporting, reviewing the code <Null> should work, try without the " " around it
I have found that none of the following combinations of configurations sets the field to Null:
Expression : IIF(1 = 1 , Null, Null) => this results in an empty string instead of Null. Log file looks fine with no errors
Log File :
Trying: EXPRESSION
Checking to verify there is a field to store the expression
Expression to be eval: iif(1 = 1,Null,Null)
Setting Value to:
Finished: EXPRESSION
-----
Expression : IIF(1 = 1 , <Null>,<Null>) => this does nothing as it is considered syntactically incorrect as per log file:
Log File :
Trying: EXPRESSION
Checking to verify there is a field to store the expression
Expression to be eval: iif(1 = 1,<Null>,<Null>)
ERROR: evaluating the expression for feature in AA_VOne with OID of 1
Syntax error
Finished: EXPRESSION
-----
Expression : IIF(1 = 1 , "", "") => this results in an empty string instead of Null which doesn't align with the online reference in my previous post above. Log file looks fine with no errors:
Log File :
Trying: EXPRESSION
Checking to verify there is a field to store the expression
Expression to be eval: iif(1 = 1,"","")
Setting Value to:
Finished: EXPRESSION
----
Expression : IIF(1 = 1 , vbNull, vbNull) => this results in the value of the vbNull which is 1 string instead of Null. Log file looks fine with no errors
Log File :
Trying: EXPRESSION
Checking to verify there is a field to store the expression
Expression to be eval: iif(1 = 1,vbNull,vbNull)
Setting Value to: 1
Finished: EXPRESSION
-----
Expression : IIF(1 = 1 , <Null>,<Null>) => this does nothing as it is considered syntactically incorrect as per log file:
Log File :
Checking to verify there is a field to store the expression
Expression to be eval: <Null>
ERROR: evaluating the expression for feature in AA_VOne with OID of 1
Syntax error
Finished: EXPRESSION
After trying many combination , the correct way to set the field to null is what is mentioned in the documentation as 'Invalid' below !
You have to use (in the simplest case) Expression = "<Null>" . that will work with string or numeric field data type , and can also be used in IIF expression or any complex VBScript expression.
Empty sting as mentioned below will never set the field to Null, regardless of the data type of the field.
Attribute operations - Attribute Assistant | ArcGIS Solutions
To set values as null, use an empty string:
IIF([LOCDESC]=0, "<NULL>", [LOCDESC])
IIF([LOCDESC]=0, "", [LOCDESC])