Select to view content in your preferred language

How do I create a statement based on list?

434
4
02-08-2024 03:24 PM
PavlovaVitale
Emerging Contributor

Hello everyone, I am new here. I have a survey where I have a list of items a person chooses from; for example:

Select the items below that are included in the report you reviewed:

1. cover page

2. title

3.signature

This is just an example the actual list is different and longer. But if I have a list like that and compliance means all items selected then all is well. But if less than 3 items selected it means out of compliance with the report requirements. So I need the survey to include a statement that says the report is out of compliance because item (whichever was not selected) was not included. How do I do that? I created a statement in the relevant column that says count-selected({$Report!=3}) below is the actual script I used so you would need to scroll all the way to see it. This works great because if the surveyor did not select all items, then it will show the note. However this does not tell me which item was not selected. How do I get it to show which item was not selected? 

noteSiteConcerns51<b>REAP content:<b>  w4    "REAPs do not include all requirements in Section VIII. E."  count-selected(${REAPMinimum})!= 7      500               
0 Kudos
4 Replies
abureaux
MVP Frequent Contributor

Is the number of items in this list static? Looks like you already have count-selected(${REAPMinimum})!= 7 which is good (I'd remove that space between = and 7 though. You don't want spaces where they don't need to be). But I'd put it into a separate calculate so you can use it in other places of the survey.

If all you are struggling with is "display the name of the thing that wasn't selected", then you will need to use a series of calculates.  This isn't the most straight forward thing for select_multiple. Here is an example where I am actually doing the opposite of you (displaying text when something is selected):

abureaux_0-1707435475002.png

This list has 4 items. The first 4 calculates get the name of the thing via jr:choice-select() and add a comma and a space to the end. The "total" calculate puts them all into a list. The "final" calculate trims off the ', ' at the end.

I work with reviews and compliance a lot. An easier solution IMO would be to have a series of select_one yes_no. Have one for each compliance item, and just ensure they select "yes" where applicable. This typically gives more fine-grain control over the review items, and is a lot easier to work with.

PavlovaVitale
Emerging Contributor
Hi thanks for the reply. I actually need it to show which ones were not selected and I am having a hard time figuring out how to do it. It will create a lot more questions if I create a choose one option instead of a select multiple list. I can figure out how to make it show if something was selected but I cant figure out how something not selected to show. I have been thinking about the visible column but that still is a problem because it will only make something visible if the argument is true and I want it to show something if the argument is false. I tried the following but for some reason it is not even acknowledging it.
count-selected(${REAPMinimum}) > 0 and selected(${REAPMinimum}, 'The date(s) rain is predicted to occur, and predicted chance of rain;') = false()

0 Kudos
abureaux
MVP Frequent Contributor

You can use not(). E.g.,

count-selected(${REAPMinimum})>0 and not(selected(${REAPMinimum}, 'The date(s) rain is predicted to occur, and predicted chance of rain'))

Is that actually what appears in your name column? That looks like a label. When writing these, you always reference the name column. E.g., I'd write selected(${ptype},'SFR') and not selected(${ptype},'Single-Tenant Residential')

abureaux_0-1707946018496.png

 

0 Kudos
PavlovaVitale
Emerging Contributor
Thank you for that idea: I went ahead and used the not() and this is what I put in the relevant column:
It did not work. I try it and it does not come up as working at all. I go to the form I select some things except for the first item and the first item still shows up as having been selected. Are there too many parenthesis? I used the name of the field instead of the label as suggested. When I run it and I select everything except the QSPNameContact option it still shows the message that it is missing and if I select that option it shows that same message that it is missing so I am not sure then what the fix should be please help!
note
SiteConcerns55

w4
"It is missing the date(s) rain is predicted to occur, and predicted chance of rain."
count-selected(${REAPMinimum}) > 0 and not(selected(${REAPMinimum}, 'QSPNameContact'))

0 Kudos