I'm creating some JSON data in a calculation using the Let function as follows:
~json = JSONSetElement ( "" ;
["id"; CustomerData::ID; JSONNumber ];
["name"; CustomerData::Name; JSONString ];
["value"; CustomerData::Value; JSONString ] )
JSONSetElement( $customer_data ; $counter ; ~json ; JSONObject )
I now need to change the value line to use JSONString as the type if there is a value and JSONNull if that field is empty. I've tried to use the Case function to do this here but I'm getting an error when I click OK on my calculation.
The Case statement would be like this:
IsEmpty ( CustomerData::Value ) ; ["value"; CustomerData::Value; JSONNull ] ;
["value"; CustomerData::Value; JSONString ]
Anyone able to show me the correct syntax to incorporate this Case statement into the Let function, or if there's a better way that's fine as well.