Have an idea?

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

Currency sing & unverified perl code

Dear All,

one of the value Im calling is numeric input cell Q23_r1_c1 , value called from this cell should be shown with currency sign USD "$". Below code works fine if there is no  " return '$'; " .  How to include the currency sign before the value?

[% Begin Unverified Perl  
 
 #   showing one of the price
 my $PriceMax=0;
if(SHOWN("Q21"))
   {
   $PriceMax=LISTLABEL("Q20Price71",1); 
   } 
else
{
 return '$';
$PriceMax=  FORMATNUMBER(GETVALUE("Q23_r1_c1"),",",".",0); 
} 

End Unverified %]</b>

would be grateful for any tip.
robson
asked Jan 15 by robson Bronze (750 points)
edited Jan 16 by robson

1 Answer

+2 votes
Strings can be concatenated with the "." operator in Perl, allowing us to return a combination of two strings.  Try this out:

return '$' . FORMATNUMBER(GETVALUE("Q23_r1_c1"), ",", ".", 0); 
answered Jan 16 by Zachary Platinum Sawtooth Software, Inc. (143,925 points)
Thank you very much Zachary !
Works perfect!
...