Forum Discussion
Wyatt_Porter
Nov 12, 2021Copper Contributor
Receiving #type! back on calculation
So I am a little stuck and would like to know if anyone can help me with the below Expression: IIf([Asset_Type]="1000",[Beginning Year]," ")+15 Ok, so for the above Expression I am receiving ...
tims
Dec 02, 2021Copper Contributor
IIf([Asset_Type]="1000",[Beginning Year]," ")+15
-That fails for a valid reason
On records <> 1000, you're attempting to assign a value of empty space and then add 15 to it.
IIf([Asset_Type]="1000",[Beginning Year]+15," ")
- This probably fails for a reason we can't see
Because we don't know the data type of [Beginning Year], to which you're attempting to add 15. So if [Beginning Year] is empty, null or text from your data source, then you'll get an error attempting to add 15 to it.
I'd experiment along the lines of what @Isladogs mentioned and verify your data types.
One solution, maybe try wrapping a Clng function around [Beginning Year] to force a long data type within the expression before you perform the arithmetic operation.
Such as;
IIf([Asset_Type]="1000",Clng([Beginning Year])+15," ")
If [Beginning Year] is already a numeric, then you would have to assign 0 or some other numeric, instead of " " as the value when <>1000.