Author |
Message
|
Lisa |
Posted: Fri Feb 20, 2004 10:02 am Post subject: Error Codes |
|
|
Master
Joined: 07 Jun 2002 Posts: 287 Location: NJ
|
All,
I need to search a string and if I find 1 of 50 error codes,
I need to move the error code to Err-Code field and
the error text message to Err-Text field.
Here's the problem. I need to code all 50 error text message in WMQI, because the string contains error code only.
How would you do this? I realy don't want to create 50 IF statements!
Lisa |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Feb 20, 2004 10:33 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Sounds like you need a table that relates an Error code to an Error string, that you could then select from. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Lisa |
Posted: Fri Feb 20, 2004 12:28 pm Post subject: Error Codes |
|
|
Master
Joined: 07 Jun 2002 Posts: 287 Location: NJ
|
THanks Jeff, But I do not want to use a DB.
Any other suggestions?
Lisa |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Feb 20, 2004 12:36 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You can run an ESQL select against a message tree, as well as a database table.
So build your "table" in Environment.Variables.MyErrorTable, or some such, and select from that.
Something like
Code: |
Set Environment.Variables.MyErrorTable = row(row(1 as ErrNum,'Error Number One has Occurred' as ErrStr),row(2 as ErrNum,'Error Number Two has Occurred' as ErrStr));
set OutputRoot.XML.Document.Err-Text = (Select the(x.ErrStr) from Environment.Variables.MyErrorTable as x where x.ErrNum = InputRoot.XML.Err-Code);
Set OutputRoot.XML.Document.Err-Code = InputRoot.XML.Err-Code; |
This is untested, off the top of my head code. So it probably doesn't work the way it's written. But the idea is valid. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Lisa |
Posted: Fri Feb 20, 2004 12:43 pm Post subject: Error Codes |
|
|
Master
Joined: 07 Jun 2002 Posts: 287 Location: NJ
|
Once again, thanks Jeff.
You have provided me with an interesting option!
Lisa |
|
Back to top |
|
 |
Michael Dag |
Posted: Sat Feb 21, 2004 5:03 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
Will you provide us a "working" sample
Michael |
|
Back to top |
|
 |
jefflowrey |
Posted: Sat Feb 21, 2004 7:29 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
MichaelDag wrote: |
Will you provide us a "working" sample  |
Me?
Or Lisa?
I'll do so if I get a chance.  _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Michael Dag |
Posted: Sat Feb 21, 2004 9:00 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
No not you... I meant Lisa!  |
|
Back to top |
|
 |
Lisa |
Posted: Sat Feb 21, 2004 6:20 pm Post subject: Error Codes |
|
|
Master
Joined: 07 Jun 2002 Posts: 287 Location: NJ
|
Yes, Once I decide on how I want to handle error message codes.
Lisa |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Feb 25, 2004 12:48 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Here's a working piece of code.
Code: |
Set Environment.Variables.MyErrorTable = ROW(
ROW(1 AS ErrNum,'Error Number One has Occurred' AS ErrStr),
ROW(2 as ErrNum,'Error Number Two has Occurred' as ErrStr));
set Environment.Variables.ErrText = (
Select ITEM X.ErrStr
from Environment.Variables.MyErrorTable.* as X
where X.ErrNum = 1); |
Which gives me the following in a trace
Code: |
(0x01000000):Variables = (
(0x01000000):MyErrorTable = (
(0x01000000):Column0 = (
(0x03000000):ErrNum = 1
(0x03000000):ErrStr = 'Error Number One has Occurred'
)
(0x01000000):Column1 = (
(0x03000000):ErrNum = 2
(0x03000000):ErrStr = 'Error Number Two has Occurred'
)
)
(0x03000000):ErrText = 'Error Number One has Occurred' |
_________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|