Have an idea?

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

Return Image using perl

Hi,

Based on the conditions I want to show a image in header section. The below return statement doesn't work for me. Could you please help me on that?
[%Begin Unverified Perl
if (LISTVALUE("ConListC",1)==1)
{
return "<img src="[%GRAPHICSPATH()%]LOGO.jpg" alt="" border="0" width="250">";
End Unverified %]
}
asked Dec 28, 2016 by Abdul Bronze (1,540 points)
retagged Dec 28, 2016 by Walter Williams

1 Answer

+1 vote
 
Best answer
A few observations:

When using Sawtooth Script in Unverified Perl, you don't use the inner "[%" or "%]."

When you have quotation marks inside a string in Perl, you should use apostrophes to define the Perl string.

You'll need to join strings using Perl's dot operator.

The "End Unverified" needs to be after the if's closing brace.

This is the return I'd use:

return '<img src="' . GRAPHICSPATH() . 'LOGO.jpg" alt="" border="0" width="250">';
answered Dec 28, 2016 by Zachary Platinum Sawtooth Software, Inc. (63,775 points)
selected Dec 28, 2016 by Abdul
Thank you so much Zachary. It works great.
...