Have an idea?

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

How can I get unverified perl script to run in local test mode?

This is in specific regard to using unverified perl in constructed lists referencing pass in fields. (Perl works fine in other cases).

I have a predefined list called Products, and based on pass in fields I make a constructed list similar to this:

Begin Unverified Perl
 if (VALUE("passinfield1") == 1)
  {  
   ADD("Products",1);
  }
 if (VALUE("passinfield2")==1)
  {  
   ADD("Products",2);
  }
 End Unverified

I then try to print out this information for respondent confirmation in a question using something like:

1. [%ListLabel (ApplicableAppliances,1)%]
2. [%ListLabel (ApplicableAppliances,2)%]

Test mode yields blank results, once uploaded to web server seems to work fine.  If it could be tested locally it would save time in manual upload etc. process. Is there something I'm missing, is it a bug, or is that intended behavior?
asked Jan 29, 2016 by anonymous

2 Answers

+1 vote
Testing locally doesn't allow you to pass-in variables, which is why your constructed list logic only works online.
answered Jan 29, 2016 by Nathan Bryce Silver Sawtooth Software, Inc. (9,380 points)
0 votes
Using the Test button to test locally will launch your survey and hit the start page, but you can actually do the same linking like you do online. For example, when you upload the survey will give you a link like this:

Start page: www.website.com/login.html
One-click link: www.website.com/cgi-bin/ciwweb.pl?studyname=XXXX&passinfield1=XXXX&passinfield2=XXXX

When you test locally you get something like this:

http://127.0.0.1:61501/surveyname/login.html

that quickly changes to

http://127.0.0.1:61501/acbc/cgi-bin/ciwweb.exe?hid_studyname=XXXX&hid_pagenum=0

If you follow the same procedure you can add in the pass-in field like you do when the survey is off on a server:

http://127.0.0.1:61501/acbc/cgi-bin/ciwweb.exe?studyname=XXXXX&passinfield1=XXXXX&passinfield2=XXXXX

There is not, however, any way to click the test button and have it automatically use values for the pass-in fields.

http://127.0.0.1:61501/acbc/cgi-bin/ciwweb.exe?hid_studyname=acbc&hid_pagenum=0
answered Jan 29, 2016 by Brian McEwan Gold Sawtooth Software, Inc. (46,545 points)
...