punch multi sub-questions using for loop

More
3 years 10 months ago - 3 years 10 months ago #95489 by first

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: 3 years 10 months ago by first.

Please Log in to join the conversation.

More
3 years 10 months ago #95491 by tpartner
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
3 years 10 months ago #95495 by first
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
3 years 10 months ago #95544 by tpartner
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.