I have an array (numbers) with 2 columns (and 14 rows). I want to validate only the second column, coded 'GS'. Values in that column should be between 1 and 19, or empty. I wrote an expression for that and it is working, but I wonder if there is a shorthand using 'self.sq_GS'. I tried, but can't figure it out.
My current expression is:
Code:
(is_empty(Sub_BP_GS.NAOK) OR (Sub_BP_GS.NAOK>0 AND Sub_BP_GS.NAOK<20)) AND (is_empty(Sub_OV_GS.NAOK) OR (Sub_OV_GS.NAOK>0 AND Sub_OV_GS.NAOK<20)) AND (is_empty(Sub_MR_GS.NAOK) OR (Sub_MR_GS.NAOK>0 AND Sub_MR_GS.NAOK<20)) AND (is_empty(Sub_CR_GS.NAOK) OR (Sub_CR_GS.NAOK>0 AND Sub_CR_GS.NAOK<20)) AND (is_empty(Sub_SSC_GS.NAOK) OR (Sub_SSC_GS.NAOK>0 AND Sub_SSC_GS.NAOK<20)) AND (is_empty(Sub_WS_GS.NAOK) OR (Sub_WS_GS.NAOK>0 AND Sub_WS_GS.NAOK<20)) AND (is_empty(Sub_GW_GS.NAOK) OR (Sub_GW_GS.NAOK>0 AND Sub_GW_GS.NAOK<20)) AND (is_empty(Sub_FS_GS.NAOK) OR (Sub_FS_GS.NAOK>0 AND Sub_FS_GS.NAOK<20)) AND (is_empty(Sub_PR_GS.NAOK) OR (Sub_PR_GS.NAOK>0 AND Sub_PR_GS.NAOK<20)) AND (is_empty(Sub_SZ_GS.NAOK) OR (Sub_SZ_GS.NAOK>0 AND Sub_SZ_GS.NAOK<20)) AND (is_empty(Sub_CLN_GS.NAOK) OR (Sub_CLN_GS.NAOK>0 AND Sub_CLN_GS.NAOK<20)) AND (is_empty(Sub_FZ_GS.NAOK) OR (Sub_FZ_GS.NAOK>0 AND Sub_FZ_GS.NAOK<20)) AND (is_empty(Sub_BG_GS.NAOK) OR (Sub_BG_GS.NAOK>0 AND Sub_BG_GS.NAOK<20)) AND (is_empty(Sub_RE_GS.NAOK) OR (Sub_RE_GS.NAOK>0 AND Sub_RE_GS.NAOK<20))
Hi,
in these cases I ask "Did you try"?
You know that "self" and "that" are intended for aggregations like count (that.Q1.sq_C1.NAOK), which might be expanded to
count(Q1_SQ001_C1.NAOK,Q1_SQ003_C1.NAOK,Q1_SQ003_C1.NAOK,...)
So if you tried to use is_empty(that.Q1.sq_C1.NAOK) you'd get is_empty(Q1_SQ001_C1, Q1_SQ002_C1, Q1_SQ003_C1)
You see the algorithm of expanding works fine but leads to wrong syntax of the function "is_empty".
Conclusion: You expression is fine.
Of course you could consider to limit the values of this column by javascript
I saw which version you are using and removed the dropdown image.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
count(self.sq_GS.NAOK) - 14 is here to reduce by empty value …
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. -
Professional support
-
Plugins, theme and development
. I don't answer to private message.
The following user(s) said Thank You: lwolters, Joffm
I mean countifop("<",1,self.sq_GS.NAOK), count "empty' value or not ?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. -
Professional support
-
Plugins, theme and development
. I don't answer to private message.
OK then countifop("<",1,self.sq_GS.NAOK) include "" value
Thank you.
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. -
Professional support
-
Plugins, theme and development
. I don't answer to private message.