Have an idea?

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

Pass-In Variables and Unverified Perl

How do I access the value of a pass-in variable in unverified perl?

In SSI Script I would use [%Type%]

Would I use VALUE("Type") in PERL?
asked Jan 12 by Corey1975 Bronze (740 points)

1 Answer

+1 vote
Yes, that is correct. That's how to relate to the pass-in field using Perl.

With pass-in fields, they do not have labels attached like a normal parent list.

So you can create a parent list for the pass-in field and access the label as such ...
LISTLABEL("TypeList",VALUE("Type"))

I have assumed "TypeList" is the name of the parent list associated to the "Type" pass-in field.

Ensure you define your variables and list names exactly as you have defined them. Perl is case sensitive.
answered Jan 12 by Paul Moon Platinum (74,205 points)
edited Jan 12 by Paul Moon
Nice solution for the labels Paul!  I've always just used Perl to return text based on the variable, but this is great time saver.
ohh...actually, now that I think about it, I could use a javascript to encode a hidden item with the appropriate text!

However, the above brings up a great point!

Can I create a parent lists for hidden variables, for example, if I make a gender item with images?

Base List: GenderDesc ; 1.Male; 2.Female

Then use PERL or SSI Script to assign labels with:

LISTLABEL("GenderDesc",VALUE("Q1_gender"))
Yes, that sounds doable. You can apply this technique to pass-in fields, hidden variables, calculated variables, merged fields, etc.
Good to see it has chimed in and helped you too Jay. This does save some time as opposed to the return Perl method.
...