Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Using two variables in Perl to build constructed list

I'm trying to build a constructed list based on the answers to two separate single-select questions. Both single-select questions have the same answer choices (same parent list). The goal of the constructed list is to produce a range of answer choices from the parent list so the starting value of the constructed list will be the answer to single-select question 1 and the end value will be the answer to single-select question 2. Does anyone know of an easy way to do this? Thanks in advance!

Just to give an idea of what I'm trying to do, my current, incorrect Perl script is this (I tried to define a new variable 'x' to be the answer to single-select question 2):

Begin Unverified Perl

 my ($i,$x)=(1,2);

 for(($i,$x)=1; ($i,$x)<=13; $i++;)
   if (VALUE("B1a")==$i && VALUE("B1b")==$x)

End Unverified
asked Mar 5, 2019 by Makella
What behavior ought to happen if the response to B1b is less than the response to B1a?  Should no items be added?  Or should the same range be added as if B1a and B1b had swapped responses?
Right now, the answer choices for B1b are from a constructed list so that only choices AFTER the answer to B1a are shown so it shouldn't be possible for B1b to be less than B1a.
In that case, I think we can put the values from the select questions straight into the "ADD":

Add(B1aList, GetValue(B1a), GetValue(B1b))
Wow much more simple than what I was trying! That worked, thank you!

Your solution to the original question

Please only use this to answer the original question. Otherwise please use comments.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

To avoid this verification in future, please log in or register.