episphere / quest

experimenting with the idea of a questionnaire markup
https://episphere.github.io/quest/
2 stars 11 forks source link

create noneExist function #346

Closed danielruss closed 3 years ago

danielruss commented 3 years ago

@joshid-ims requested extending doesNotExist to include multiple elements.

danielruss commented 3 years ago

added a function noneExist(...element_ids) which takes 0 or more element ids and return true if NONE of the elements have values associated with them. If you have a typo and the element id does not exist, it is not a problem but it does not exists -- Caveat emptor. If you provide 0 arguments, noneExists returns true.

example: [LALALA,displayif=noneExist("AAA","BBB","CCC")] You will only see this question if you did not answer question AAA BBB or CCC. Do you see this question?

YN

[END] Ta da!!!

danielruss commented 3 years ago

@iqbal-singh I used js varchar arguments to handle the multiple inputs. I probably should have let you implement it. Take a look please.

joshid-ims commented 3 years ago

Thanks Daniel! I will try this in the markup.

joshid-ims commented 3 years ago

Can this be used in conditional display of text with '|'? Like |displayif=noneExist("AAA","BBB")|is||displayif=noneExist("ccc","ddd")|are|

danielruss commented 3 years ago

yes here is my test module

[ABC] This should be shown
#YN

[BCD,displayif=noneExist('AAA','BBB')] This should be shown also
#YN

[CDE,displayif=noneExist('ABC','BBB')] This should not be shown if you answered question ABC |displayif=noneExist('ABC','BBB')|,which you did not do|
#YN

[DEF,displayif=noneExist('AAA','BCD')] This should not be shown
#YN

[END] Well we've reached the end of the road.  So long and thanks for all the fish

NOTE you have to NOT answer the first question.

joshid-ims commented 3 years ago

And it should be double quotes, right? "AAA"

danielruss commented 3 years ago

double or single quotes. Just not smart quotes... so be careful if you use MS word/excel...