Syntax for formula

I have 17 digit product hierarchy from MARA table. I need a column in the report from first two digits. If [First two digit = 00 Then, ABC], else if [First two digits = 01 then DEF], else [if first two digits = 02 Then, XYZ] like this…

I am looking for the correct syntax for this formula…


Developer_Designer (BOB member since 2009-08-09)

There are two ways to achieve this:

Procedure1: In this you need to create two formulas

Formula1:

mid(field,1,2)—This will give you first 2 characters

Formula2:

If Formula1=00 then ‘ABC’ else
If Formula1=01 then ‘DEF’ else
if …etc

Procedure2: Create a formula like below.

Local stringvar get2digit;
get2digit:=mid(field,1,2);

If get2digit=00 then ‘ABC’ else
If get2digit=01 then ‘DEF’ else
If get2digit=02 then ‘XYZ’

get2digit;

Hope this helps…


anil.ganga1 :us: (BOB member since 2007-07-04)