‎2007 Jan 11 6:16 AM
hi all,
i got one scenario that i have got 2 amounts
one is with value 200.00 and other value 100.00-
so now i have to convert 100.00- to 100.00
and comapre that out of 200 & 100 which is greater.
then calculate the profit & loss by subtracting these amount.
u may be confused that why can't we comapre directly 200 & 100-
directly . but let me tell u that it will be problem bcoz if we will subtract 100- from 200 then we will get 300 which will be wrong.
so my requirement is to relace the neagtive sign from the amount
then only compare these two amounts and then only calculate profit & loss.
‎2007 Jan 11 6:18 AM
if amount lt 0.
v_amount = amount * ( -1 ).
endif.
now compare with v_amount,
regards
shiba dutta
‎2007 Jan 11 6:18 AM
if amount lt 0.
v_amount = amount * ( -1 ).
endif.
now compare with v_amount,
regards
shiba dutta
‎2007 Jan 11 6:19 AM
hi
you have two methods.
first one is add the variables. then 200 and 100- will become 100. that would give u a result.
another method is...
var1 contains '200'.
var2 contains '100-'.
if var2 LT 0.
var2 = var2 * ( -1 ).
if var1 LT var2.
--
--
--
endif.
endif.
thx
pavan
‎2007 Jan 11 6:21 AM
hi Sanjeev,
i think there is no need of comparing and then subtracting one value from the other. you just add both those values and if the sum is greater than '0' then it is profit else it means that its a loss.
if i've answered u right award points.
Kiran
‎2007 Jan 11 6:29 AM
Hi sanjeev,
if u r using scripts ,
&symbol(s)&
<b>&itcdp-tdulpos& -
> 100-
&itcdp-tdulpos(s)& -
> 100
</b>
if u r using reports,
suppose v_field1 contains 100- then,
v_field1 = v_field1 * (-1)
then do u r comparision
‎2007 Jan 11 6:29 AM
‎2007 Jan 11 6:34 AM
‎2007 Jan 11 7:55 AM
Hi All,
there are many ways of doing that. Suppose there are two variables v1 and v2.
v1 = 100-.
v2 = 200.
Method 1: if abs(v1) gt abs(v2).
Method 2 : replace '-' in v2 with ''
Method3:
if v2 lt 0.
v2 = v2 * -1.
endif.
‎2007 Jan 11 12:12 PM
Hi Sanjeev ,
I have a doubt reagading this concept what is you have the values 100 and 200- , then you will get 100 as diffrence , but actually it must be 100-.
Why dont you just add all the values to get the profit/loss details.
Regards
Arun