Have an idea?

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

Perl script question


Does anybody know what I would have to change in order to make this work? Its the [% that's not working inside the perl script.

[% Begin Unverified Perl

    return "[% Label(Q6) %]";

End Unverified %]

Thank you.
asked Nov 13, 2019 by Line

1 Answer

+1 vote
You are correct that the second "[%" is the problem.  Any "[% ... %]" nested inside another "[% ... %]" will throw an error.  Instead, you need to call the function the Perl way, similar to what you've already done by using "VALUE" instead of "[% Value() %]":

[% Begin Unverified Perl
if (VALUE("Q6") == 9) {
    return LABEL("Q6");
End Unverified %]
answered Nov 13, 2019 by Zachary Platinum Sawtooth Software, Inc. (147,200 points)
Yes, exactly. This works great, thank you :)