Closed joshid-ims closed 2 years ago
There seems to be an issue with the regex Pattern for Radio/Checkboxes when there is a displayif as long as there is no space, the pattern works. However, with the new displayif logic, there can be a space. This is the underlying problem. Looking into it
It also cannot take a quote to start the displayif..
Example module:
[H1]
|displayif="exists('STNUM') or doesNotExist('lala')"|1. ding dong|
|displayif=doesNotExist('STNUM')|2. ding dong|
(1,displayif=equals(isNotDefined(STNUM,""),"")) 1. Yes, this list is complete {$u:STNUM} {$STNUM}
(2,displayif="exists('STNUM')") 2. Yes, this list is complete {$u:STNUM} {$STNUM}
(3,displayif=doesNotExist('STNUM')) 3. Yes, this list is complete
[END]
Workaround: If you dont have any spaces you dont need the quotes. so you can use |
without spaces.
[H1]
Hi There
(1,displayif=exists("STNUM")) STNUM is defined
(2,displayif=exists("FULLST")) FULLST is defined
(3,displayif=exists("STNUM")&exists("FULLST")) STNUM and FULLST are defined
(4,displayif=exists("STNUM")|exists("FULLST")) STNUM or FULLST is defined
(5,displayif=noneExist("STNUM","FULLST")) Neither STNUM or FULLST is defined
(6,displayif=someExist("STNUM","FULLST")) either STNUM or FULLST or both is defined
(7,displayif=allExist("STNUM","FULLST")) both STNUM and FULLST or both is defined
[END]
either clear the memory or add the following to Previous Results:
{
"STNUM":1,
"FULLST":"Main Street"
}
or
{
"STNUM":1
}
or
{
"STNUM":1,
"FULLST":"Main Street"
}
if @naiyume or @iqbal-singh want to take a shot at fixing the regex. I beleive the problem is on line 343 of replace.js
What about this?
(1,displayif=noneExist("STNUM1","FULLST1","APT1","CITY1","CITY1_FOLLOWUP","ST1","ST1_FOLLOWUP","ZIP1","ZIP1_FOLLOWUP","COUNTRY1","COUNTRY1_FOLLOWUP")or valueEquals("HOMEADDOTH1",1))
This is not rendering
[H1]
(1,displayif=noneExist("STNUM1","FULLST1","APT1","CITY1","CITY1_FOLLOWUP","ST1","ST1_FOLLOWUP","ZIP1","ZIP1_FOLLOWUP","COUNTRY1","COUNTRY1_FOLLOWUP")|valueEquals("HOMEADDOTH1",1)) lala
[END]
Spaces are not allowed, so you must use a single pipe as or -- |
try with
{ "STNUM1":"123", "HOMEADDOTH1":"1" }
I tried it with whole markup and it still does not render. I did not try the short version you gave. Just changed my code with this new syntax. Like this:
(1,displayif=noneExist("STNUM1","FULLST1","APT1","CITY1","CITY1_FOLLOWUP","ST1","ST1_FOLLOWUP","ZIP1","ZIP1_FOLLOWUP","COUNTRY1","COUNTRY1_FOLLOWUP")|valueEquals("HOMEADDOTH1",1))|displayif=noneExist("STNUM1","FULLST1","APT1","CITY1","CITY1_FOLLOWUP","ST1","ST1_FOLLOWUP","ZIP1","ZIP1_FOLLOWUP","COUNTRY1","COUNTRY1_FOLLOWUP")|2nd Address||displayif=or(equals(isNotDefined(STNUM1,""),false),or(equals(isNotDefined(FULLST1,""),false),or(equals(isNotDefined(APT1,""),false),or(equals(isNotDefined(CITY1,""),false),or(equals(isNotDefined(CITY1_FOLLOWUP,""),false),or(equals(isNotDefined(ST1,""),false),or(equals(isNotDefined(ST1_FOLLOWUP,""),false),or(equals(isNotDefined(ZIP1,""),false),or(equals(isNotDefined(ZIP1_FOLLOWUP,""),false),or(equals(isNotDefined(COUNTRY1,""),false),equals(isNotDefined(COUNTRY1_FOLLOWUP,""),false)))))))))))|{$STNUM1} {$FULLST1} {$APT1} {$CITY1} {$CITY1_FOLLOWUP} {$ST1} {$ST1_FOLLOWUP} {$ZIP1} {$ZIP1_FOLLOWUP} {$COUNTRY1} {$COUNTRY1_FOLLOWUP}|
I'm not sure why, but if you put a newline between |displayif...|2nd Address|
and the next |displayif...|
it parses correctly
[H1]
(1,displayif=noneExist("STNUM1","FULLST1","APT1","CITY1","CITY1_FOLLOWUP","ST1","ST1_FOLLOWUP","ZIP1","ZIP1_FOLLOWUP","COUNTRY1","COUNTRY1_FOLLOWUP")|valueEquals("HOMEADDOTH1",1))|displayif=noneExist("STNUM1","FULLST1","APT1","CITY1","CITY1_FOLLOWUP","ST1","ST1_FOLLOWUP","ZIP1","ZIP1_FOLLOWUP","COUNTRY1","COUNTRY1_FOLLOWUP")|2nd Address|
|displayif=or(equals(isNotDefined(STNUM1,""),false),or(equals(isNotDefined(FULLST1,""),false),or(equals(isNotDefined(APT1,""),false),or(equals(isNotDefined(CITY1,""),false),or(equals(isNotDefined(CITY1_FOLLOWUP,""),false),or(equals(isNotDefined(ST1,""),false),or(equals(isNotDefined(ST1_FOLLOWUP,""),false),or(equals(isNotDefined(ZIP1,""),false),or(equals(isNotDefined(ZIP1_FOLLOWUP,""),false),or(equals(isNotDefined(COUNTRY1,""),false),equals(isNotDefined(COUNTRY1_FOLLOWUP,""),false)))))))))))|{$STNUM1} {$FULLST1} {$APT1} {$CITY1} {$CITY1_FOLLOWUP} {$ST1} {$ST1_FOLLOWUP} {$ZIP1} {$ZIP1_FOLLOWUP} {$COUNTRY1} {$COUNTRY1_FOLLOWUP}|
[END]
ok. This is harder than I thought. The workaround discussed up works only for Radio/checkboxes. Why does is not work for the |displayif=x|x| case? Because the pipe is regex thinks the pipe is boundary. So use OR in the |displayif='noneExist() or valueEquals()| case|. BUT use the pipe for or in the radiobutton/checkbox case.
[H1]
Hi There
(1,displayif=noneExist("STNUM1","FULLST1","APT1","CITY1","CITY1_FOLLOWUP","ST1","ST1_FOLLOWUP","ZIP1","ZIP1_FOLLOWUP","COUNTRY1","COUNTRY1_FOLLOWUP")|valueEquals("HOMEADDOTH1",1))|displayif=noneExist("STNUM1","FULLST1","APT1","CITY1","CITY1_FOLLOWUP","ST1","ST1_FOLLOWUP","ZIP1","ZIP1_FOLLOWUP","COUNTRY1","COUNTRY1_FOLLOWUP")|2nd Address| |displayif=someExist|{$STNUM1} {$FULLST1} {$APT1} {$CITY1} {$CITY1_FOLLOWUP} {$ST1} {$ST1_FOLLOWUP} {$ZIP1} {$ZIP1_FOLLOWUP} {$COUNTRY1} {$COUNTRY1_FOLLOWUP}|
[END]
That works, but the logic does not make sense to me.
But I am using new function noneExists only in the radio button as you suggested. I am not changing the rest of my code. Am I missing something?
// type, paste, or upload questionnaire markup
[H1]
Hi There
(1,displayif=noneExist("STNUM1","FULLST1","APT1","CITY1","CITY1_FOLLOWUP","ST1","ST1_FOLLOWUP","ZIP1","ZIP1_FOLLOWUP","COUNTRY1","COUNTRY1_FOLLOWUP")|valueEquals("HOMEADDOTH1",1)) 2nd Address
(1,displayif=someExist("STNUM1","FULLST1","APT1","CITY1","CITY1_FOLLOWUP","ST1","ST1_FOLLOWUP","ZIP1","ZIP1_FOLLOWUP","COUNTRY1","COUNTRY1_FOLLOWUP")|valueEquals("HOMEADDOTH1",1)) {$STNUM1} {$FULLST1}
[H2]
Question 2:
(1,displayif=valueEquals("HOMEADDOTH1",1)|someExist("STNUM1","FULLST1","APT1","CITY1","CITY1_FOLLOWUP","ST1","ST1_FOLLOWUP","ZIP1","ZIP1_FOLLOWUP","COUNTRY1","COUNTRY1_FOLLOWUP")) |displayif=noneExist("STNUM1","FULLST1","APT1","CITY1","CITY1_FOLLOWUP","ST1","ST1_FOLLOWUP","ZIP1","ZIP1_FOLLOWUP","COUNTRY1","COUNTRY1_FOLLOWUP")|2nd Addresss| |displayif=exists("STNUM1")|{$STNUM1} ||displayif=exists("FULLST1")|{$FULLST1} ||displayif=exists("APT1")|{$APT1} ||displayif=exists("CITY1")|{$CITY1} ||displayif=exists("CITY1_FOLLOWUP")|{$CITY1_FOLLOWUP} ||displayif=exists("ST1")|{$ST1} ||displayif=exists("ST1_FOLLOWUP")|{$ST1_FOLLOWUP} ||displayif=exists("ZIP1")|{$ZIP1} ||displayif=exists("ZIP1_FOLLOWUP")|{$ZIP1_FOLLOWUP} ||displayif=exists("COUNTRY1")|{$COUNTRY1} |
(2,displayif=valueEquals("HOMEADDOTH2",1)|someExist("STNUM2","FULLST2","APT2","CITY2","CITY1_FOLLOWUP","ST2","ST2_FOLLOWUP","ZIP2","ZIP2_FOLLOWUP","COUNTRY2","COUNTRY2_FOLLOWUP")) |displayif=noneExist("STNUM2","FULLST2","APT2","CITY2","CITY2_FOLLOWUP","ST2","ST2_FOLLOWUP","ZIP2","ZIP2_FOLLOWUP","COUNTRY2","COUNTRY2_FOLLOWUP")|2nd Addresss| |displayif=exists("STNUM2")|{$STNUM2} ||displayif=exists("FULLST2")|{$FULLST2} ||displayif=exists("APT2")|{$APT2} ||displayif=exists("CITY2")|{$CITY2} ||displayif=exists("CITY2_FOLLOWUP")|{$CITY2_FOLLOWUP} ||displayif=exists("ST2")|{$ST2} ||displayif=exists("ST2_FOLLOWUP")|{$ST2_FOLLOWUP} ||displayif=exists("ZIP2")|{$ZIP2} ||displayif=exists("ZIP2_FOLLOWUP")|{$ZIP2_FOLLOWUP} ||displayif=exists("COUNTRY2")|{$COUNTRY2} |
[END]
As we discussed in call, I tried someExist in there and it does not work either. Will be talking with Jen and possibly NCI to discuss the logic so I can use a single condition displayif=equals("HOMEADDOTH1",1) in the radio buttons, at least for now.
(0)|displayif=noneExist("STNUM","FULLST","APT","CITY","CITY_FOLLOWUP","ST","ST_FOLLOWUP","ZIP","ZIP_FOLLOWUP","COUNTRY","COUNTRY_FOLLOWUP")|Current Address ||displayif=or(equals(isNotDefined(STNUM,""),false),or(equals(isNotDefined(FULLST,""),false),or(equals(isNotDefined(APT,""),false),or(equals(isNotDefined(CITY,""),false),or(equals(isNotDefined(CITY_FOLLOWUP,""),false),or(equals(isNotDefined(ST,""),false),or(equals(isNotDefined(ST_FOLLOWUP,""),false),or(equals(isNotDefined(ZIP,""),false),or(equals(isNotDefined(ZIP_FOLLOWUP,""),false),or(equals(isNotDefined(COUNTRY,""),false),equals(isNotDefined(COUNTRY_FOLLOWUP,""),false)))))))))))| {$STNUM} {$FULLST} {$APT} {$CITY} {$CITY_FOLLOWUP} {$ST} {$ST_FOLLOWUP} {$ZIP} {$ZIP_FOLLOWUP} {$COUNTRY} {$COUNTRY_FOLLOWUP}|
(1,displayif=equals(HOMEADDOTH1,1))|displayif=noneExist("STNUM1","FULLST1","APT1","CITY1","CITY1_FOLLOWUP","ST1","ST1_FOLLOWUP","ZIP1","ZIP1_FOLLOWUP","COUNTRY1","COUNTRY1_FOLLOWUP")|2nd Address||displayif=or(equals(isNotDefined(STNUM1,""),false),or(equals(isNotDefined(FULLST1,""),false),or(equals(isNotDefined(APT1,""),false),or(equals(isNotDefined(CITY1,""),false),or(equals(isNotDefined(CITY1_FOLLOWUP,""),false),or(equals(isNotDefined(ST1,""),false),or(equals(isNotDefined(ST1_FOLLOWUP,""),false),or(equals(isNotDefined(ZIP1,""),false),or(equals(isNotDefined(ZIP1_FOLLOWUP,""),false),or(equals(isNotDefined(COUNTRY1,""),false),equals(isNotDefined(COUNTRY1_FOLLOWUP,""),false)))))))))))|{$STNUM1} {$FULLST1} {$APT1} {$CITY1} {$CITY1_FOLLOWUP} {$ST1} {$ST1_FOLLOWUP} {$ZIP1} {$ZIP1_FOLLOWUP} {$COUNTRY1} {$COUNTRY1_FOLLOWUP}|
Simple code for display if works but this is not rendering. for displayif=equals(HOMEADDOTH1,1).
get error:
I mean this works:
[VALUE?]
Street number |__|__|id=STNUM min=0 max=999999|
Full Street name |__|id=FULLST|
Street number |__|__|id=STNUM1 min=0 max=999999|
Full Street name |__|id=FULLST1|
[SELECT?] Select one
(0) yes
(1) no
[TEST?] displayif test
(0) |displayif=noneExist("STNUM","FULLST")|Current Address|{$STNUM} {$FULLST}
(1,displayif=equals(SELECT,1)) |displayif=noneExist("STNUM1","FULLST1")|2nd Address|{$STNUM1} {$FULLST1}
[END]
Is there a limit on number of arguments for noneExist?
no
For or it is '|', what is for and?
&
Thanks
@joshid-ims It took a few sec to realize what you were doing. You example is a great SSCCE and makes debugging easy.
The example you gave works as expected. You made the value of NO=1, so the second button only shows if you select no.
Yes, but the question/code in the comment before that does not work.
I see. working on it...
[HOMEADD1_1?] What is the full street address of the place where you live now?
Street number |__|__|id=STNUM min=0 max=999999|
Full Street name |__|id=FULLST|
Apartment, suite, unit, building, etc. |__|__|id=APT|
City |__|id=CITY|
State/Province |__|id=ST|
Zip code |__|__|id=ZIP min=0|
Country |__|id=COUNTRY|
[HOMEADDOTH1?] Within the <b>past 20 years</b>, have you lived anywhere else for <b>at least two years</b>?
(1) Yes -> HOMEADD1_2
(0) No -> HOMEADDSUM
< #NR-> HOMEADDSUM >
[HOMEADD1_2?] What is the full street address of the place you lived before you moved to the place you live now? Please only include addresses where you have lived for <b>at least two years</b>.
Street number |__|__|id=STNUM1 min=0 max=999999|
Full Street name |__|id=FULLST1|
Apartment, suite, unit, building, etc. |__|__|id=APT1|
City |__|id=CITY1|
State/Province |__|id=ST1|
Zip code |__|__|id=ZIP1 min=0|
Country |__|id=COUNTRY1|
[INTROCH] <b>Childhood Home</b>
The next questions ask about where you lived as a child.
[CHILDADD?] What was the street address of your childhood home (where you lived when you were about 13 years old)?
(0) I lived at a previous address already entered -> CHILDTEST
(1) Not listed here -> CHILDADD1
< #NR -> CHILDADD1>
// This is so Quest knows which previous address the user entered is the Child Address that they want to use for future questions
[CHILDTEST?] Which previously entered address did you live at when you were about 13 years old?
(0)|displayif=noneExist("STNUM","FULLST","APT","CITY","ST","ZIP","COUNTRY")|Current Address||displayif=or(equals(isNotDefined(STNUM,""),false),or(equals(isNotDefined(FULLST,""),false),or(equals(isNotDefined(APT,""),false),or(equals(isNotDefined(CITY,""),false),or(equals(isNotDefined(ST,""),false),or(equals(isNotDefined(ZIP,""),false),equals(isNotDefined(COUNTRY,""),false)))))| {$STNUM} {$FULLST} {$APT} {$CITY} {$ST} {$ZIP} {$COUNTRY} |
(1,displayif=noneExist("STNUM1","FULLST1","APT1","CITY1","ST1","ZIP1","COUNTRY1")|valueEquals("HOMEADDOTH1",1)) |displayif=noneExist("STNUM1","FULLST1","APT1","CITY1","ST1","ZIP1","COUNTRY1")|2nd Address||displayif=equals(isNotDefined(STNUM1,""),false)|{$STNUM1}||displayif=equals(isNotDefined(FULLST1,""),false)| {$FULLST1}||displayif=equals(isNotDefined(APT1,""),false)| {$APT1}||displayif=equals(isNotDefined(CITY1,""),false)| {$CITY1}||displayif=equals(isNotDefined(ST1,""),false)| {$ST1}||displayif=equals(isNotDefined(ZIP1,""),false)| {$ZIP1}||displayif=equals(isNotDefined(COUNTRY1,""),false)| {$COUNTRY1}|
[HOMEADDSUM] skipped to here...
[END,end] Thank you
Works for me... Although I simplified the display logic.
Let me try. I need to use & instead of |.
Even if I use this, it does not render in whole module 4 markup.
(1,displayif=noneExist("STNUM1","FULLST1","APT1","CITY1","CITY1_FOLLOWUP","ST1","ST1_FOLLOWUP","ZIP1","ZIP1_FOLLOWUP","COUNTRY1","COUNTRY1_FOLLOWUP")&valueEquals("HOMEADDOTH1",1))|displayif=noneExist("STNUM1","FULLST1","APT1","CITY1","CITY1_FOLLOWUP","ST1","ST1_FOLLOWUP","ZIP1","ZIP1_FOLLOWUP","COUNTRY1","COUNTRY1_FOLLOWUP")|2nd Address||displayif=or(equals(isNotDefined(STNUM1,""),false),or(equals(isNotDefined(FULLST1,""),false),or(equals(isNotDefined(APT1,""),false),or(equals(isNotDefined(CITY1,""),false),or(equals(isNotDefined(CITY1_FOLLOWUP,""),false),or(equals(isNotDefined(ST1,""),false),or(equals(isNotDefined(ST1_FOLLOWUP,""),false),or(equals(isNotDefined(ZIP1,""),false),or(equals(isNotDefined(ZIP1_FOLLOWUP,""),false),or(equals(isNotDefined(COUNTRY1,""),false),equals(isNotDefined(COUNTRY1_FOLLOWUP,""),false)))))))))))|{$STNUM1} {$FULLST1} {$APT1} {$CITY1} {$CITY1_FOLLOWUP} {$ST1} {$ST1_FOLLOWUP} {$ZIP1} {$ZIP1_FOLLOWUP} {$COUNTRY1} {$COUNTRY1_FOLLOWUP}|
I get this syntax error:
@joshid-ims Thanks to @naiyume, who caught a bug in my code, We were able to push a fix. Your issue appears to be resolved. Please test and close if resolved.
Ok, I could test this today. Following code is still not rendering correctly. It does not show a radio button, just a blank space.
(0)|displayif=noneExist("STNUM","FULLST","APT","CITY","CITY_FOLLOWUP","ST","ST_FOLLOWUP","ZIP","ZIP_FOLLOWUP","COUNTRY","COUNTRY_FOLLOWUP")|Current Address ||displayif=or(equals(isNotDefined(STNUM,""),false),or(equals(isNotDefined(FULLST,""),false),or(equals(isNotDefined(APT,""),false),or(equals(isNotDefined(CITY,""),false),or(equals(isNotDefined(CITY_FOLLOWUP,""),false),or(equals(isNotDefined(ST,""),false),or(equals(isNotDefined(ST_FOLLOWUP,""),false),or(equals(isNotDefined(ZIP,""),false),or(equals(isNotDefined(ZIP_FOLLOWUP,""),false),or(equals(isNotDefined(COUNTRY,""),false),equals(isNotDefined(COUNTRY_FOLLOWUP,""),false)))))))))))| {$STNUM} {$FULLST} {$APT} {$CITY} {$CITY_FOLLOWUP} {$ST} {$ST_FOLLOWUP} {$ZIP} {$ZIP_FOLLOWUP} {$COUNTRY} {$COUNTRY_FOLLOWUP}|
(1,displayif=noneExist("STNUM1","FULLST1","APT1","CITY1","CITY1_FOLLOWUP","ST1","ST1_FOLLOWUP","ZIP1","ZIP1_FOLLOWUP","COUNTRY1","COUNTRY1_FOLLOWUP")&valueEquals("HOMEADDOTH1",1))|displayif=noneExist("STNUM1","FULLST1","APT1","CITY1","CITY1_FOLLOWUP","ST1","ST1_FOLLOWUP","ZIP1","ZIP1_FOLLOWUP","COUNTRY1","COUNTRY1_FOLLOWUP")|2nd Address||displayif=or(equals(isNotDefined(STNUM1,""),false),or(equals(isNotDefined(FULLST1,""),false),or(equals(isNotDefined(APT1,""),false),or(equals(isNotDefined(CITY1,""),false),or(equals(isNotDefined(CITY1_FOLLOWUP,""),false),or(equals(isNotDefined(ST1,""),false),or(equals(isNotDefined(ST1_FOLLOWUP,""),false),or(equals(isNotDefined(ZIP1,""),false),or(equals(isNotDefined(ZIP1_FOLLOWUP,""),false),or(equals(isNotDefined(COUNTRY1,""),false),equals(isNotDefined(COUNTRY1_FOLLOWUP,""),false)))))))))))|{$STNUM1} {$FULLST1} {$APT1} {$CITY1} {$CITY1_FOLLOWUP} {$ST1} {$ST1_FOLLOWUP} {$ZIP1} {$ZIP1_FOLLOWUP} {$COUNTRY1} {$COUNTRY1_FOLLOWUP}|
But '|' (or) works!
(1,displayif=noneExist("STNUM1","FULLST1","APT1","CITY1","CITY1_FOLLOWUP","ST1","ST1_FOLLOWUP","ZIP1","ZIP1_FOLLOWUP","COUNTRY1","COUNTRY1_FOLLOWUP")|valueEquals("HOMEADDOTH1",1))
@danielruss @joshid-ims Does the solution Deepti found resolve this issue, or does this issue need to be kept open?
ok to close?
@joshid-ims
If we want to add a displayif in an option or radio button like bellow, it does not work.