Gossamer Forum
Quote Reply
Substraction possible?
Hi!

i have two variables: A and B, both are numbers.
Now i need to find out the difference between both numbers and make the result "/ 10".

e.g.: A = 100, B = 75, so C = 25, output is: 2,5

Can i realize this directly inside the template-tags?
This doesnt works: <%set C= $A - $B%> <%C/10%>

Who can help me?

Greetings,

Coyu
Quote Reply
Re: [Coyu] Substraction possible? In reply to
Hi,

Try;

<%set C = $A - $B%>
<%set D = $C / 10%>
<%D%>

Hope that helps.

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!
Quote Reply
Re: [Andy] Substraction possible? In reply to
Hey Andy,

thx but it doesnt works. I gt A and B from diffrernt variables:

<%set A = $Re_Betrag_Temp%>
<%set B = $Zahlbetrag%>
<%set C = $A - $B%>

I get for <%A%> a result, for <%B%> too, but <%C%> is emtpy.

What i do wrong?

Coyu
Quote Reply
Re: [Coyu] Substraction possible? In reply to
Hi,

You might need to use a global then;

<%do_sums($A,$B)%>

Code:
sub {

my $_a = $_[0];
my $_b = $_[1];

my $_c = $_a - $_b;
my $_d = $_c / 10;
return $_d;
}

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!
Quote Reply
Re: [Coyu] Substraction possible? In reply to
Hi Corc,

I have worked with the - in the template sucessfully

Can you try as below?

<%set A = $Re_Betrag_Temp%>
<%set B = $Zahlbetrag%>
<%set C = $A%>
<%set C -= $B%>

Cheers,



Cheers,

Dat

Programming and creating plugins and templates
Blog