Skip to Content
author's profile photo Former Member
Former Member

negative to positive amount

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

8 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2007 at 06:18 AM

    if amount lt 0.

    v_amount = amount * ( -1 ).

    endif.

    now compare with v_amount,

    regards

    shiba dutta

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2007 at 06: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2007 at 06: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2007 at 06: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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 11, 2007 at 06:29 AM

    Hi,

    v1 = abs( 100.00-).

    Then compare.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2007 at 06:34 AM

    thanks for solving my issue.

    i have rewarded all ur efforts

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2007 at 07: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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2007 at 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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.