Solved IF THEN with text

Discussion forum about all things Report Builder (all versions).
mriege
United States of America
Posts: 2
Joined: 13 Sep 2023, 12:48
Location: USA

IF THEN with text

Post by mriege » 13 Sep 2023, 13:40

Hi - I am using OpenText Gupta Report Builder 7.0 which is hooked to our ERP system.
I need to create a formula that does the following;
If Op_Run_Type = PCS/HR then OP_RUN*9.1
If Op_Run_Type= Load/HR then 10
If Op_Run_Type=HR/LOAD then 10
If Op_Run_Type= HR/PCs the 1/9.1*OP_RUN
if anything else "ERROR"

I have looked at the documentation for NumberIFF and STRIFF but don't understand how to use it when comparing strings of text.
Thank you

Giorgio Bravi
Italy
Posts: 111
Joined: 09 Mar 2017, 18:08
Location: Bergamo, Italy

Re: IF THEN with text

Post by Giorgio Bravi » 15 Sep 2023, 10:48

I'm not using Report Builder but you can start from a formula like that assuming itemTXT is the string to compare and OP_RUN a numeric value

NumberIFF( StrCompare( itemTXT, 'string1' ), 0, OP_RUN*9.1, NumberIFF( StrCompare( itemTXT, 'string2' ), 0, 10, NumberIFF( StrCompare( itemTXT, 'string3' ), 0, 10, NumberIFF( StrCompare( itemTXT, 'string4' ), 0, 1/OP_RUN*9.1, 0 ) ) ) )

Consider string values in alphabetic order because StrCompare return <0, 0, or > 0 depending on the value of the compared string
Giorgio Bravi
BLUENEXT SRL
www.bluenext.it
www.dolphin.it

mriege
United States of America
Posts: 2
Joined: 13 Sep 2023, 12:48
Location: USA

Re: IF THEN with text

Post by mriege » 15 Sep 2023, 15:50

Thank you. Gupta was very particular about spaces. I did get it to work.

User avatar
Steve Leighton
Site Admin
Site Admin
New Zealand
Posts: 338
Joined: 05 Mar 2017, 20:57
Location: Stroud, England <--> Tauranga, New Zealand

Re: IF THEN with text

Post by Steve Leighton » 17 Sep 2023, 02:45

Giorgio

I DO use Report Writer - a lot , and am impressed with your formula.
Thanks for sharing !
Greetings from New Zealand
Steve Leighton

Bankside Systems Ltd.
UK ♦ Australia ♦ New Zealand

www.banksidesystems.co.uk

Image

Giorgio Bravi
Italy
Posts: 111
Joined: 09 Mar 2017, 18:08
Location: Bergamo, Italy

Re: IF THEN with text

Post by Giorgio Bravi » 18 Sep 2023, 09:35

I'm happy to have made a contribution and hope it solves the problem.
Giorgio Bravi
BLUENEXT SRL
www.bluenext.it
www.dolphin.it

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 1 guest