episphere / quest

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

Using noneExist as an argument in 'and' function #350

Closed joshid-ims closed 2 years ago

joshid-ims commented 3 years ago

We need to use noneExist in something like this:

|displayif=and(equals(HOMEADDOTH1,1),noneExist("STNUM1","FULLST1","APT1","CITY1","CITY_FOLLOWUP1","ST1","ST_FOLLOWUP1","ZIP1","ZIP_FOLLOWUP1","COUNTRY1","COUNTRY_FOLLOWUP1"))|2nd Address|

joshid-ims commented 3 years ago

This is for use in Module 4

danielruss commented 3 years ago

Fix is in... Waiting for @iqbal-singh to review my Pull Request.

danielruss commented 3 years ago

syntax

|displayif=valueEquals("HOMEADDOTH1",1) and noneExist("STNUM1","FULLST1","APT1","CITY1","CITY_FOLLOWUP1","ST1","ST_FOLLOWUP1","ZIP1","ZIP_FOLLOWUP1","COUNTRY1","COUNTRY_FOLLOWUP1"))|2nd Address|
danielruss commented 3 years ago

@joshid-ims

[Q1] This is question 1: #YN

[Q2] This is question 2: 
#YN

[Q3] Show I complain if Q1 and Q2 where not filled out #YN

[Q4,displayif=valueEquals("Q3","yes") and noneExist("Q2","Q1")] Why did you not answer 1 and 2?

[END] All done...

works for me.. Let me know if it works for you.

joshid-ims commented 3 years ago

I will try this later and will let you know. Thanks!

joshid-ims commented 3 years ago

In this case:

|displayif=valueEquals("HOMEADDOTH1",1) and noneExist("STNUM1","FULLST1","APT1","CITY1","CITY1_FOLLOWUP","ST1","ST1_FOLLOWUP","ZIP1","ZIP1_FOLLOWUP","COUNTRY1","COUNTRY1_FOLLOWUP"))|2nd Address|

either CITY1 or CITY1_FOLLOWUP exist, similarly for ST!, ZIP1 and COUNTRY1. Also APT1 may not be always present. So depending on how users enter address, some of these may not exist. So 2nd Address gets displayed always as this noneExist is true only when none of these are present. It is useful in some other places but not this.

I am not sure how I would specify these conditions. So maybe I need OR with multiple arguments?

danielruss commented 3 years ago

let's simply for a sec. You want to display the text if:

HOMEADDOTH=1 AND
[ BOTH CITY1,STATE1 dont exist ] OR [ CITY1_FOLL,STATE1_FOLL dont exist]

valueEquals("HOMEADDOTH1",1) and ( noneExist("CITY1","STATE1") or noneExist("CITY1_FOLL","STATE1_FOLL") )

joshid-ims commented 3 years ago

no, rather, do not display the the text when even one of the fields have value.

Users may enter only street or only state or country and that too only in follow up. It is very unpredictable and then there is "If this information is not correct, please click the “Back” button to edit your answers before moving on." option at the end of this. So they can go back and correct it. Usually city, state/province, zip and country will have value for CITY or CITY_followup, for e.g,, not both.

Not sure if this explains it well.

joshid-ims commented 3 years ago

I have thought of a workaround with present code. Maybe I will ask Nicole about it.

This is to display '2nd Address' in the beginning instead of at the end (there is '2nd Address Provided:' anyway in the beginning if address is entered by user) and display actual address later if entered. That way it will look like:

if address is entered 2nd Address: 1234 ABC Blvd XYZ City MD USA instead of 2nd Address Provided: 1234 ABC Blvd XYZ City MD USA 2nd Address

if address is not entered it will be like 2nd Address:

danielruss commented 2 years ago

@joshid-ims Is this resolved?

joshid-ims commented 2 years ago

Kinda. I am changing code to add workaround that NCI is ok with.