Have an idea?

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

Displaying a new value based on a pass-in field value

I'm trying to reference a pass-in field in order to display a different value associated to the pass-in field.

For example: if the value is CI, it should show "Club Infield", if the value is CO, it should show "Club Outfield"

I've tried the below, but it's still not working:

 [% Begin Unverified Perl
my %currentLoc = (
"CI" => "Club Infield (Food Included)",
“CO" => "Club Outfield (Food Included)",
return $currentLocation{VALUE("CurrentLoc")};

End Unverified %]
asked 6 days ago by Nicole

1 Answer

+1 vote
A few things stand out to me:

Your hash is named "currentLoc," but you refer to it as "currentLocation" on line 6.  Both of these spots should use the same name.

On line 4, you've used a fancy quotation mark character, perhaps from Microsoft Word or another text editor.  We need to use plain quotation mark characters like you have used elsewhere on that line and on other lines.

You do not need the comma on line 4.  In programming, we often use commas to split up items in arrays or objects.  So we require a comma after every item EXCEPT the last one.  For example:

my %hash = (
    "key 1" => "value 1",
    "key 2" => "value 2",
    "key 3" => "value 3",
    "key 4" => "value 4",
    "key 5" => "value 5"
answered 6 days ago by Zachary Platinum Sawtooth Software, Inc. (171,950 points)