Validating just a subquestion in an array text question

More
1 month 1 week ago #167469 by mfiora
mfiora created the topic: Validating just a subquestion in an array text question
Hello,
i'd need an answer to a subquestion in an array text question to match a regular expression.
I looked around finding a way but simply could not.
First of all, where should i set it? In the question validation or in the sub-question validation?
I found out the SGQ(row and column) identifier but any test could not help.
Could you please provide me with an example?
Thank you very much.

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago - 1 month 1 week ago #167473 by Joffm
Joffm replied the topic: Validating just a subquestion in an array text question
Hello, mfiora,

Could you please provide me with an example?


The other way: You should provide us with an example (*.lss).
That we exactly know what you are trying to achieve.

Best regards
Joffm

P.S. Without knowing more I can say:
in the question validation you can to access this special field by something like
Q1_SQ001_A3
Q1= Question code
SQ001 = Subquestion code (y-axis)
A3 = code of x-axis

Q1_SQ001_A3=="lorem ipsum" validates this field to this special text.
In your case it will be something like this in "question validation":
is_empty(self.sq_SQ001_A3) or regexMatch('/^[1-9]{1,3}$/',self.sq_SQ001_A3)

More explanation about this:
https://manual.limesurvey.org/Expression_Manager#The_reserved_.27this.27.2C_.27self.27.2C_and_.27that.27_variables

and:
https://manual.limesurvey.org/Expression_Manager_examples#Question_with_X_and_Y_scales
Last Edit: 1 month 1 week ago by Joffm.

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #167477 by mfiora
mfiora replied the topic: Validating just a subquestion in an array text question
Hello Joffm and thanks for your reply,
You can see attached the test survey. I would like the fiscal code to match the regular expression
/^(\w{6}\d{2}\w\d{2}\w\d{3}\w)|(\d{11})$/

and highlight the field if it doesn't match.

I still am confused on where should i put the code you provided me with, sorry.

Thanks
Attachments:

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #167479 by Joffm
Joffm replied the topic: Validating just a subquestion in an array text question
Hi, mfiora,

1. you were confused about the syntax "self.sq_Y-X"
The first is the code of the y-axis, the second of the x-axis.
Because you named the y-axis "1", "2", "3", and the x-ais "SQ001" you entered a wrong statement.

And you enter it in

I assume there will be more columns - otherwise you should have used a "multiple short text" question.
So you have to o this for all columns:
(is_empty(self.sq_3_SQ001) or regexMatch('/^(\w{6}\d{2}\w\d{2}\w\d{3}\w)|(\d{11})$/',self.sq_3_SQ001)) AND
(is_empty(self.sq_3_SQ002) or regexMatch('/^(\w{6}\d{2}\w\d{2}\w\d{3}\w)|(\d{11})$/',self.sq_3_SQ002)) AND
(is_empty(self.sq_3_SQ003) or regexMatch('/^(\w{6}\d{2}\w\d{2}\w\d{3}\w)|(\d{11})$/',self.sq_3_SQ003))


2. Example (a correct code)


something else



Best regards
Joffm
Attachments:

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #167480 by mfiora
mfiora replied the topic: Validating just a subquestion in an array text question
Hello Joffm,
i found out. First there was some confusion between X and Y axis. Then i probably got lost in translation because you typed "Question validation" and i thought about "validation" field, but it was "Question validation equation".
And i also found a problem in Regexp.
Now it works.

Thanks for your support and patience.

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago - 1 month 1 week ago #167481 by Joffm
Joffm replied the topic: Validating just a subquestion in an array text question
Hi, mfiora,

sorry,
yes, I know: I always wite "question validation" and "subquestion validation" instead of "... equation"

But nevertheless, I learned about Italian fiscal codes.
Nobody knows when I will need this knowledge.;)

Best regards
Joffm
Last Edit: 1 month 1 week ago by Joffm.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!