Skip to Content
avatar image
Former Member

Multiple statements in an IF THEN

Hi,

I have a report where, very occasionally, I might have multiple values in a collapsed line (@ two group levels actually, Pos, and Bez)

If I encounter this, I need to set a hi value and a lo value for each (displayed @ PosFooterA and B, and BezFooterA and B).

If I don't, I need the lo value to remain at 0, so I can check it, and collapse PozFooterB and BezFooterB.

As I recall, I've always been able to avoid multiple statements within an IF THEN, but here I am...

The error I'm getting is that the PolishPricePosHi just before the "and" needs to be a Boolean.

What is the syntax I need for this?

WhilePrintingRecords;

Global NumberVar PolishPricePosHi;

Global NumberVar PolishPricePosLo;

Global NumberVar PolishPriceBezHi;

Global NumberVar PolishPriceBezLo;

if {BW_ANGEB_STKL.BOM_PRODUKT} in [9101]

then

if PolishPricePosHi = 0

then PolishPricePosHi := {BW_ANGEB_STKL.PR_PREIS_ME}

else

if {BW_ANGEB_STKL.PR_PREIS_ME} > PolishPricePosHi

then PolishPricePosLo := PolishPricePosHi

and PolishPricePosHi := {BW_ANGEB_STKL.PR_PREIS_ME};

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jan 07, 2015 at 05:38 PM

    HI Matt,

    Try:

    WhilePrintingRecords;

    Global NumberVar PolishPricePosHi;

    Global NumberVar PolishPricePosLo;

    Global NumberVar PolishPriceBezHi;

    Global NumberVar PolishPriceBezLo;

    if {BW_ANGEB_STKL.BOM_PRODUKT} in [9101]

    then

    (

      if PolishPricePosHi = 0 then

      PolishPricePosHi := {BW_ANGEB_STKL.PR_PREIS_ME}

      else if {BW_ANGEB_STKL.PR_PREIS_ME} > PolishPricePosHi then

      (

      PolishPricePosLo := PolishPricePosHi;

      PolishPricePosHi := {BW_ANGEB_STKL.PR_PREIS_ME};

      )

    )

    -Abhilash

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thank you Abhilash,

      My logic is pretty sharp good, but my memory for syntax in abominable.

      I was attempting a semi-colon to separate but was too sparse with my parenthesis.