I am trying to create a Relevant statement that would enable a field if a condition is met in one field or if a different condition is met in a separate field. For example:
I want a 'Comment' field to become visible if ${IssueWithThing1} = 'yes' or ${IssueWithThing2} = 'yes'
Right now it gives me an error. Is there a way to make this expression work?
Solved! Go to Solution.
Hi Liam,
Yes, you can use similar logic for select multiple questions, you may just need to use the select() or contains() expressions to validate if the choices you want to use for the selection have been selected or are contained in the string that is generated when a user selects values in a select multiple. Have a look how the values are stored and then you can work out the way to check if the value you want is selected and then make further questions relevant or not.
Phil.
Hi @LiamWhite,
Yes you can use relevant statements based on select multiple questions. You will need to configure your expression to calculate the relevance based on it containing the values or test you are trying to match. Remember the answer to the select multiple will be a comma delaminated string.
Regards,
Phil.
Hi Shawn,
What is the error code you are receiving? The expression you have used is correct, example below:
${issuewiththing1} = 'yes' or ${issuewiththing2} = 'yes'
Regards,
Phil.
I have a related question, I am trying to make multiple values (options) pass the relevant criteria.
My idea was that it would be something like:
${issuewiththing1} = 'yes', 'sortof', 'abit'
or in my case:
${activity} = ('D', 'S', 'R')
where D, S and R are select_one options (five options, relevant question for three of those options)
I really wanted to avoid having to write it as
${activity} = 'D' or ${activity} = 'S' or ${activity} = 'R'
Advice is greatly welcome.
Hi Dan,
Aside from the length, is there a reason to avoid the last line?
One way you could approach it would be using a regex (Relevant expressions—Survey123 for ArcGIS | ArcGIS 😞
regex(${activity}, "D|S|R")
The | character separates alternatives to check for
this is sometihng im trying to do also, but i have a list of items 31 possibilities for the vaule i want to be seen or not seen. is there a way to do this so i wont have to type 31 vaules ${myfiled} = 'answer1', 'answser2', 'answer'?
Hi Jevita,
Either way when you are attempting to show relevance of a following question based on 31 previous different answers you will need to type in the values into a calculation. The two options for this are the original way I suggested in this post with "or" statements using the question name and answer if they are from different questions, or as James pointed out, using regex statements when there is more than one value from the same question. Both ways require you having to enter (type) the values into the calculation that you want to be used to make the following question relevant.
Phil.
Thanks for this!
I was trying to figure out a way to set relevance on parts of a survey by multiple logins and the regex you showed helped me.
regex(${activity}, "D|S|R")
I created a csv:
UserGroup,UserList
City,JackJohnson|JillJohnson
Contractor,MarkSmith|MikeSmith
Then pulled the the user name lists into separate hidden questions:
CityUsers - pulldata('UserInfo','UserList','UserGroup','City')
ContractorUsers - pulldata('UserInfo','UserList','UserGroup','Contractor'')
now in the relevant column I just use this to hide or show based on who is logged in.
regex(property('username'), ${ContractorUsers})
regex(property('username'), ${CityUsers })
I looked for properties for either role or groups for the current user, but is doesn't look like that exists.
-bert
I realised I never actually got back to you on this one James. Yes, it was to just minimise the length. Although the user decided to go in a different direction and we didn't really need to pursue this option anymore.
Also, it reminded me about that old joke "If you have a problem that you need to solve with regex, well now you have two problems!"
That last one is funny!!!
Hi Phil, should this method work for a select_one multiple choice question. I am looking to enable a questions based on whether the response to the multiple choice is: "yes" OR "maybe"
Thanks