locked
IFF nesting RRS feed

  • Question

  • struggling with how to do this in the select statement:   if Ledger.curr="CAN and ledger.bookper< val(LBookfrom), Ledger.osloss * ,
    else if Ledger.curr="CAN and ledger.bookper >=val(LBookfrom), Ledger.osloss * nCurr ,
    else Ledger.osloss as osloss

    am I close ?

    IIF((Ledger.curr)="CAN" AND ledger.bookper< Val((LBookfrom),Ledger.osloss * nChgVal,
        IIF((Ledger.curr)="CAN" AND ledger.bookper>= Val((LBookfrom),Ledger.osloss * Val(nCurr),Ledger.osloss) as OSLOSS
    Tuesday, August 4, 2009 3:16 PM

Answers

  • Exactly where you are trying to do this? At query level or expression? Anyway, to do this in query, try this:

    case Ledger.curr
        when 'CAN' then case when ledger.bookper < Val(LBookfrom) then Ledger.osloss * nChgVal
                                     else Ledger.osloss * nCurr
                                 end
        else Ledger.osloss
    end as osloss


    Chicagoan ...
    Tuesday, August 4, 2009 3:27 PM
    Answerer

All replies

  • Exactly where you are trying to do this? At query level or expression? Anyway, to do this in query, try this:

    case Ledger.curr
        when 'CAN' then case when ledger.bookper < Val(LBookfrom) then Ledger.osloss * nChgVal
                                     else Ledger.osloss * nCurr
                                 end
        else Ledger.osloss
    end as osloss


    Chicagoan ...
    Tuesday, August 4, 2009 3:27 PM
    Answerer
  • My apologies, wrong forum, was meant for foxpro
    Tuesday, August 4, 2009 3:35 PM
  • I am simply using the select statement using the ledger table creating an output file into cursor , converting osloss based on conversion rates.
    Tuesday, August 4, 2009 3:52 PM