How to write a CASE statement

Alex_ChowAlex_Chow Member Posts: 5,063
edited 2008-09-23 in NAV Tips & Tricks
Sorry for another newbie post. But just in case I ever forget:
CASE TextVar OF
  'A' : TextVar1 := 'OMG';
  'B' : 
    BEGIN
      TextVar1 := 'OMG2';
      TextVar2 := 'OMG3';
    END;
  ELSE
    TextVar1 := 'OMG3';
END;

If TextVar is an option variable, you would use:
CASE TextVar OF
  TextVar::A : TextVar1 := 'OMG';
  TextVar::B : 
    BEGIN
      TextVar1 := 'OMG2';
      TextVar2 := 'OMG3';
    END;
  ELSE
    TextVar1 := 'OMG3';
END;

Comments

Sign In or Register to comment.