If statement without else action

185
6
10-05-2022 11:16 AM
Hammers211
New Contributor III

Is it possible to have an if statement that takes no action when returned false?

Example using a statement I am using currently:

if(${Course_Completed}= 'CC8001W' , 'Complete', 'Incomplete')

I would like to remove the 'Incomplete' part, like this:

if(${Course_Completed}= 'CC8001W' , 'Complete')

So that the only changes to the data will be to input Complete.

 

Or in other words, if current data exists, do not change it.

 

Any help?

0 Kudos
6 Replies
jcarlson
MVP Honored Contributor

What field are you using to populate this? You must have a parameter for when the condition is false, but that parameter could be an expression that grabs data from something else.

Trying to calculate a field based on data in the same field can easily get into a circular reference situation, which S123 will more than likely reject.

- Josh Carlson
Kendall County GIS
Hammers211
New Contributor III

 


@jcarlson wrote:

You must have a parameter for when the condition is false, but that parameter could be an expression that grabs data from something else.


Is it possible to have that expression grab the data from the current field?

0 Kudos
jcarlson
MVP Honored Contributor

I mean, go ahead and try it. I think it will throw an error, though.

- Josh Carlson
Kendall County GIS
0 Kudos
Hammers211
New Contributor III

Would you mind helping me put together the expression? I don't quite have the skills for that yet.

0 Kudos
LaurenceTait
Occasional Contributor II

I'm not entirely clear what you want to do.

If you literally just want to return an empty value directly, you can simply use the following: 

if(${Course_Completed}= 'CC8001W' , 'Complete','')

If you want to maintain current data from another field unless the completion status is a certain value, then you need to use that field as an option in the if statement:

if(${Course_Completed}= 'CC8001W' , 'Complete',${current_data})

If you could explain what you are actually trying to achieve and why, it would be easier to work out the solution.

LaurenceTait_0-1665012906364.pngLaurenceTait_1-1665012968197.png

 

 

0 Kudos
Hammers211
New Contributor III

Thank you for the reply, this is helpful.

I am using the edit mode in this case and often there will already be a value of "Complete" in the "CC8001W_Complete" field. In such cases, I do not want to modify that data, I would like it left as is. I think what you are suggesting with using ${current_data}) is close to what I need, however I can't get it to work. Is ${current_data}) an actual string I can input? Or by current_data are you referring to another specific field?

0 Kudos