Relevant formula that references Range question type not working

474
6
Jump to solution
04-28-2022 08:54 AM
archeomason
New Contributor III

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

0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Esteemed Contributor

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

View solution in original post

6 Replies
DougBrowning
MVP Esteemed Contributor

Try ${Inclusions_Other} = ''  Also string-length(${Inclusions_Other})>0 can work in some situations.

Hope that helps

0 Kudos
archeomason
New Contributor III

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. 

0 Kudos
DougBrowning
MVP Esteemed Contributor

Can you post the form for troubleshooting?

0 Kudos
archeomason
New Contributor III

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. 

0 Kudos
DougBrowning
MVP Esteemed Contributor

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

archeomason
New Contributor III

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.