Home : Products : Gossamer Links : Development, Plugins and Globals :

Products: Gossamer Links: Development, Plugins and Globals: Re: [Westin] How to get a total from certain fields?: Edit Log

Here is the list of edits for this post
Re: [Westin] How to get a total from certain fields?
Ok, NP - well, try this then:

do_count_numbers
Code:
sub {
my $total;
for (my $i=0; $i <= 54; $i++) {
print qq|working on $i, with value of : $_[$i] <br /> |;
if ($_[$i] =~ /^\d+$/) { $total += $_[$i]; }
}
return $total
}

..then call with:
Code:
<%set total_cardqty = do_count_numbers($cardqty1, $cardqty2, $cardqty3, $cardqty4, $cardqty5, $cardqty6, $cardqty7, $cardqty8, $cardqty9, $cardqty10, $cardqty11, $cardqty12, $cardqty13, $cardqty14, $cardqty15, $cardqty16, $cardqty17, $cardqty18, $cardqty19, $cardqty20, $cardqty21, $cardqty22, $cardqty23, $cardqty24, $cardqty25, $cardqty26, $cardqty27, $cardqty28, $cardqty29, $cardqty30, $cardqty31, $cardqty32, $cardqty33, $cardqty34, $cardqty35, $cardqty36, $cardqty37, $cardqty38, $cardqty39, $cardqty40, $cardqty41, $cardqty42, $cardqty43, $cardqty44, $cardqty45, $cardqty46, $cardqty47, $cardqty48, $cardqty49, $cardqty50, $cardqty51, $cardqty52, $cardqty53, $cardqty54, $cardqty55)%>
TOTAL WAS <%total_cardqty%>

Again, untested - but should work.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy: Apr 29, 2009, 7:58 AM

Edit Log: