Gossamer Forum
Quote Reply
20 Percent Global
Hi,

I've created a field called: Price

Can someone help me make a global that takes 20% of the "Price". I would like to include this global in the "link.html" as <%20percent%>.

Thanks in advances.
Quote Reply
Re: [mrcry11] 20 Percent Global In reply to
Try something like:

sub { return sprintf("%.2f", (($_[0]->{Price} / 100) * 20)) }

Last edited by:

RedRum: Feb 11, 2002, 1:26 PM
Quote Reply
Re: [RedRum] 20 Percent Global In reply to
Or

sub { return sprintf("%.2f", $_[0]->{Price} * .2); }

=)

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] 20 Percent Global In reply to
I thought I'd leave something for you to improve upon Smile
Quote Reply
Re: [RedRum] 20 Percent Global In reply to
Thanks a lot!!

Is this ok?

sub { return sprintf("%.2f", ($_[0]->{Price} + ($_[0]->{Price} * .2))); }