Have an idea?

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

Constructed List Using perl


I need to create a list of brands a person has SHOPPED at, but NOT made a purchase. This is based on two numeric grid questions:

Q4. How many times have you shopped at each of the following home improvement stores during the past 60 days, whether or not you made a purchase?

Q10. You said that you had shopped at each of these home improvement stores a certain number of times in the past 60 days. How many of those times did you actually make a purchase the past 60 days?

I need a list created where Q4>0 AND Q10<Q4 (indicating they have shopped, and they have purchased fewer times than they have shopped).  Q10 is populated from a Q4 constructed list ("ShoppedwithOth").

I tried this Perl, but I'm very new at it and I can't figure out why it's not working:
Begin Unverified Perl

if ((VALUE("Q4_r1_c1")>0) && 
    ((VALUE("Q10_r1_c1") < (VALUE("Q4_r1_c1")) ) ) {

if ((VALUE("Q4_r2_c1")>0) && ((VALUE("Q10_r2_c1") < (VALUE("Q4_r2_c1")) ) ) {
if ((VALUE("Q4_r3_c1")>0) && ((VALUE("Q10_r3_c1") < (VALUE("Q4_r3_c1")) ) ) {

if ((VALUE("Q4_r4_c1")>0) && ((VALUE("Q10_r4_c1") < (VALUE("Q4_r4_c1")) ))  {

if ((VALUE("Q4_r5_c1")>0) && ((VALUE("Q10_r5_c1") < (VALUE("Q4_r5_c1")) ) ) {

End Unverified

Would appreciate any help. Thanks!
asked Oct 21, 2013 by cschlosser Bronze (945 points)
You really should be adding from the parent list, not the constructed list. You mention that ShoppedWithOth is a constructed list. First make sure it uses the same parent as the list that you are using Perl on, second replace ADD("ShoppedWithOth" with ADD("Q4ParentList" (whatever its name is)

1 Answer

0 votes
I can't see any obvious syntax errors in your code. If you could send a copy of your ssi file to paul.moon@beatonglobal.com I could look through it for you and try to get it working. Regards.
answered Oct 22, 2013 by Paul Moon Platinum (98,770 points)
I have sent you a personal email indicating the missing brackets in your Perl script.