- Posts: 40
- Thank you received: 2
Case Statement Syntax Help
4 years 8 months ago #18868
by cstaley
Case Statement Syntax Help was created by cstaley
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.
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.
4 years 8 months ago #18869
by admin
Mike
ETL Architect
Replied by admin on topic Case Statement Syntax Help
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;
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;
Mike
ETL Architect
Please Log in or Create an account to join the conversation.
4 years 8 months ago #18870
by cstaley
Replied by cstaley on topic Case Statement Syntax Help
This works.
Thank you.
Thank you.
Please Log in or Create an account to join the conversation.