punch multi sub-questions using for loop

More
4 years 2 months ago - 4 years 2 months ago #95489 by first
first created the topic: punch multi sub-questions using for loop

File Attachment:

File Name: code.txt
File Size:2 KB

I want to punch the products based upon the brands selected . Right now my CODE 1 is working fine but this is not a good way to do this.I want to do it using code 1 (using loop).Can someone please help me why it is not working.I spent several hours but no success. please help.

brands question id is B.
array Brands has brands sub-questions codes.

I have attached my code because it is not reflecting properly here.

Survey Designer and Programmer
Attachments:
Last Edit: 4 years 2 months ago by first.

Please Log in to join the conversation.

More
4 years 2 months ago #95491 by tpartner
tpartner replied the topic: punch multi sub-questions using for loop
The loop won't work because everything inside the Expression Manager curly braces is parsed at the server level so cannot contain JavaScript variables.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
4 years 2 months ago #95495 by first
first replied the topic: punch multi sub-questions using for loop
Tony thank you very much...

I also tried ((B_1.NAOK == "Y")) but no success. This condition works fine in relevance field . Can you please help me how can I use it in for loop.

Survey Designer and Programmer

Please Log in to join the conversation.

More
4 years 2 months ago #95544 by tpartner
tpartner replied the topic: punch multi sub-questions using for loop
Well, as I said, I don't think you can do this using Expression Manager and a loop. The "Brands" and "Products" arrays don't exist when the expression is parsed so the loop cannot work.

I think you'll have to do it the hard way.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

Did you already participate in our customer survey?

Don't miss your chance for great prices.

Please click here to participate:

Start now

Start now!

Just create your account and start using Limesurvey today.

Register now