Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Case Statement Syntax Help

Case Statement Syntax Help 2 months 1 week ago #18868

  • cstaley
  • cstaley's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 32
  • Karma: 2
  • Thank you received: 2
I am needing some help with case statement syntax.

Currently using Visual Importer Enterprise 9.2.2.6. I'm attempting to follow the example provided. I'm not getting the result expected. I'm unable to find other resources showing proper syntax.

I have eight different values available for a text field of MKT_Class__c. Each field is three characters. I want to change those three characters to something more intuitive.

For example anytime EXP is seen it needs to be changed to Export. DEL needs to change to Deli. This is what I've setup that isn't working.

case [MKT_CLASS__C] of
1:'EXP'
Result :='Export';
2:'DEL'
Result :='Deli';
3:'RET'
Result :='Retail';
4:'GOV'
Result :='Government';
5:'ING'
Result :='Ingredient';
6:'CHN'
Result :='Chain';
7:'IND'
Result :='Industrial';
8:'FSV'
Result :='Foodservice';
else
Result := [MKT_CLASS__C];
end;

I've also removed the numbers to see if that helped. Nothing changed.

If a different function would be better please let me know.

Please Log in or Create an account to join the conversation.

Case Statement Syntax Help 2 months 1 week ago #18869

  • admin
  • admin's Avatar
  • Offline
  • Moderator
  • Moderator
  • Deeds not Words
  • Posts: 7453
  • Karma: 33
  • Thank you received: 399
Case only works with numerical values

www.etl-tools.com/wiki/vimpe/scripting_language

You can use "IF" statement instead

This one works

begin
If [CATEGORYNAME] = 'Seafood' then Result := 'S'
else if [CATEGORYNAME] = 'Produce' then Result := 'P'
else Result := 'U';
end;

Please Log in or Create an account to join the conversation.

Mike

Case Statement Syntax Help 2 months 1 week ago #18870

  • cstaley
  • cstaley's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 32
  • Karma: 2
  • Thank you received: 2
This works.
Thank you.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1

We have 249 guests and no members online