Posted: Tue Oct 07, 2003 6:10 am Post subject: Invalid Code
Master
Joined: 21 Nov 2002 Posts: 200
I have a message flow that needs to set an output tag based on the value of an input tag. I use a CASE statement to set the output tag. When I test it using the valid values, everything is okay. When I test it using a bad value (DD) for the input tag, it does not work. Can someone see what I may be doing wrong? Here is my input XML and the code:
CODE:
DECLARE DWC CHAR;
SET DWC = InputRoot.XML.SyncSpecDutyIn.DataArea.SpecDutyIn.Crew.DefaultWorkCenter;
SET OutputRoot.XML.SyncSpecDutyIn.DataArea.SpecDutyIn.Crew.DefaultWorkCenter =
CASE DWC
WHEN 'CK' THEN 'Cockeysville'
WHEN 'FS' THEN 'Front St.'
WHEN 'HW' THEN 'Western'
WHEN 'DO' THEN 'Dorsey'
END;
IF (OutputRoot.XML.SyncSpecDutyIn.DataArea.SpecDutyIn.Crew.DefaultWorkCenter <> 'Cockeysville' and
OutputRoot.XML.SyncSpecDutyIn.DataArea.SpecDutyIn.Crew.DefaultWorkCenter <> 'Front St.' and
OutputRoot.XML.SyncSpecDutyIn.DataArea.SpecDutyIn.Crew.DefaultWorkCenter <> 'Western' and
OutputRoot.XML.SyncSpecDutyIn.DataArea.SpecDutyIn.Crew.DefaultWorkCenter <> 'Dorsey') THEN
SET OutputRoot.XML.SyncSpecDutyIn.DataArea.SpecDutyIn.Crew.DefaultWorkCenter = 'Front St.'; END If;
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
From your code it looks like the 'bad' one needs to be set to 'Front St.', if this is the case: add the ELSE clause (like below)
Code:
DECLARE DWC CHAR;
SET DWC = InputRoot.XML.SyncSpecDutyIn.DataArea.SpecDutyIn.Crew.DefaultWorkCenter;
SET OutputRoot.XML.SyncSpecDutyIn.DataArea.SpecDutyIn.Crew.DefaultWorkCenter =
CASE DWC
WHEN 'CK' THEN 'Cockeysville'
WHEN 'FS' THEN 'Front St.'
WHEN 'HW' THEN 'Western'
WHEN 'DO' THEN 'Dorsey'
ELSE 'Front St.'
END;
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum