Select to view content in your preferred language

Survey123 If Then but no Else

4123
15
09-23-2019 01:15 PM
JulienCHARBONNAUD
Regular Contributor

Hello

In my Survey123 form, I want to use the If expression in the Calculation column. By default, in the formula if (condition, a, b), you need a and b, in my case I will not want any action if the condition is not fulfilled.

Example if (format-date ($ {DateMeasure}, '% W') = 27, $ {Biom}, NO ACTION WISHES)

because it means that my cell is already informed and I do not want to overwrite its content

If anyone has a trick

Thank you very much

(Google translation)

15 Replies
JulienCHARBONNAUD
Regular Contributor
In fact I have not put in the loop 
because then in I can not resume the data in the dashboard 
via the multinotation sheet
0 Kudos
DougBrowning
MVP Esteemed Contributor

You can use another field to join them or something.  The way you have it will not work.

0 Kudos
MarvinDavis
Occasional Contributor

It would seem to me you need multiple fields to get exactly what you desire. Make a date field that is hidden from the user, then have a read-only field and have an if() statement that will populate the week number you need. This way it's only sourcing the original date, not showing it unless you state it in the if() statement.

0 Kudos
NicholasDay
Occasional Contributor

Hi Julien, the calculation I use is for a text field, where the users enter responses throughout the survey and then all the answers are concatenated into a single field for viewing and ease of use on a Feature Report. Here is an example of the calculation.

if(${L1Note}=0,””,concat(“L1: "+${L1Note})+”\n”)+if(${L2Note}=0,””,concat(“L2: "+${L2Note})+”\n”)

In this instance, 0 represents an empty text field. The "" is the DO NOTHING part of the code. So if the remark field has no entry, enter nothing, else enter the note tag, value, and a carriage return. This is repeated as needed.

0 Kudos
FMGEngineering
New Contributor

Why is the false condition required? In other scripting I've used, the false condition isn't always a requirement. I think even Arcade scripting allows you to run an if statement without providing a false condition in ArcGIS Pro for stuff like labeling and/or attribute calculations.

 

For my form, I ask the user what type of a duct are you looking at. If it is vacant, I know there isn't an innerduct. But other options may or may not have have innerducts. This seems pretty significant. I thought if statements without false returns were rather common?  

0 Kudos
RobertAnderson3
MVP Regular Contributor

I've definitely found myself encountering this more. Especially in repeats.

For mine it may be an activity defaulting the asset type, but it may not always be true, having the false argument of '' clears the default causing them to need to make a selection, or it changes as they scroll through. Stuff like that.

Is there really still not a regular option for no else @JamesTedrick ?

0 Kudos