Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Validation of column values

  • ttmedia
  • ttmedia's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 11 months ago #228117 by ttmedia
Validation of column values was created by ttmedia
Please help us help you and fill where relevant:Your LimeSurvey version: Version 3.28.9+220503Own server or LimeSurvey hosting: Own
Survey theme/template: Default
==================
I'm struggling with validation of a Array type question:

 

The idea is that each column can add up to no more than 100 (eg 100%)

But the validation I have set is counting the column total rather than the individual column so this happens:

 

This is the Subquestion validation equation

sum(self.sq_1.NAOK)<=100 AND sum(self.sq_2.NAOK)<=100 AND sum(self.sq_3.NAOK)<=100


I don't see how to alter this to make it apply only on a per column basis.

I would not display the Grand Total in the finished survey as it would make no sense but it helps explain what is going wrong I think!

REX
 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Online
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 11 months ago #228119 by Joffm
Replied by Joffm on topic Validation of column values
Hi,
you did not show the codes of the two scales.

I assume you used "SQ001", "SQ002",... for the y-scale?
Then "self.sq_1" takes the SQ001 row into acount as well, (the code contains a "1").

So ple4ase show your coding.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • ttmedia
  • ttmedia's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 11 months ago - 1 year 11 months ago #228120 by ttmedia
Replied by ttmedia on topic Validation of column values
This is what the Subquestion validation equation look like

 

This i think shows that it is counting across the columns, rather than just a single column. But I've no idea how to change this !
Last edit: 1 year 11 months ago by ttmedia.

Please Log in to join the conversation.

  • ttmedia
  • ttmedia's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 11 months ago #228121 by ttmedia
Replied by ttmedia on topic Validation of column values
Attaching the question in LSQ format

Please Log in to join the conversation.

  • ttmedia
  • ttmedia's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 11 months ago #228122 by ttmedia
Replied by ttmedia on topic Validation of column values
Hi Jeff
I'd set up the questions very quickly and I can see that they've been allocated the same codes

 

for X scale and Y scale.

Rex

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Online
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 11 months ago #228123 by Joffm
Replied by Joffm on topic Validation of column values
Of course, with your coding you can't distinguish between rows and columns.
I think you were a bit confused how this "self.sq_..." works.
As you saw above every QCode that contains a "1" is summed up; like your first sum
sum(self.sq_1):
sum(array_SQ001_SQ001, array_SQ001_SQ002, array_SQ001_SQ003, array_SQ002_SQ001, array_SQ003_SQ001, array_SQ004_SQ001, array_SQ005_SQ001)

These variables "self" and "that" are very mighty; but you have to think about a suitable coding.

Solution:
Code your y-axis "Y01", "Y02", "Y03",...
your x-axis "X01", "X02", "X03",...

Now the validation is
sum(self.sq_X01.NAOK)<=100 AND sum(self.sq_X02.NAOK)<=100 AND sum(self.sq_X03.NAOK)<=100

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • ttmedia
  • ttmedia's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 11 months ago #228124 by ttmedia
Replied by ttmedia on topic Validation of column values
Many thanks for your help. That now works.

You were right, I did not understand how self.sq_.. works!

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose