Hello, community -
I am having difficulty getting a formula I've placed in a text field's "relevant" column (on XLSForm) to work.
I would like the text field ${Inclusions_Other_Desc} to be visible if the user chooses a value in a range question ${Inclusions_Other}. If the user doesn't interact with that range slider (presumably because there are no "Other" inclusions), then the ${Inclusions_Other_Desc} isn't needed, so it'd be hidden. So in it's simplest terms show the text box if the range slider is not null/empty.
When I try the form out, the text field is visible regardless of the ${Inclusions_Other} selection. Here's the formula I have in the ${Inclusions_Other_Desc} 'relevant' column:
not(selected(${Inclusions_Other},''))
I've also tried integer-focused formulas like ${Inclusions_Other}>0 in the relevant column to no avail.
I've read through ESRI's Formulas guidance and focused on the discussions relevant to null/empty values and the unique setup of range questions, but I'm clearly missing something.
Could someone chime in on where I might be off course?
Thank you in advance -
Mason
Solved! Go to Solution.
Ohhh its a range question! They seem to be funky in the way they work since it stores numbers.
I got string(${Inclusions_Other}) != '' to work fine.
Then my guess is if they also pick 0 you want to hide it right? That one was funky too but this does it.
string(${Inclusions_Other}) != '' and string(${Inclusions_Other}) != '0'
Best way to test these is make a note field with the calc of ${Inclusions_Other} so you can see what is going on. Way easier to troubleshoot.
Hope that helps
Try ${Inclusions_Other} = '' Also string-length(${Inclusions_Other})>0 can work in some situations.
Hope that helps
Thank you for those suggestions, @DougBrowning. I tried them both out and, unfortunately, neither worked.
The first suggestion resulted in no change (I'd tried that one before but gave it another go). The second prompted an error message.
Can you post the form for troubleshooting?
Sure thing... I'm uploading it here. For what it's worth, this is the same form that I'm having trouble with the conditional If() calculation problem I posted about this morning as well.
Ohhh its a range question! They seem to be funky in the way they work since it stores numbers.
I got string(${Inclusions_Other}) != '' to work fine.
Then my guess is if they also pick 0 you want to hide it right? That one was funky too but this does it.
string(${Inclusions_Other}) != '' and string(${Inclusions_Other}) != '0'
Best way to test these is make a note field with the calc of ${Inclusions_Other} so you can see what is going on. Way easier to troubleshoot.
Hope that helps
Well, I bow to you, good sir...
Thank you very much. Your suggestion worked perfectly. I hadn't noticed the != operator in the documentation. That was the key. Thank you for the suggestion, too. I'll do that.