Author |
Message
|
catwood2 |
Posted: Thu Apr 08, 2004 8:51 am Post subject: Referring to a variable in Field reference |
|
|
Centurion
Joined: 17 May 2002 Posts: 108
|
I'm missing something obvious here.
I am doing a lookup in a database that returns various fields to drive transformation. One of the values is the XML_TAG to transform. I assign this value to a variable. Then, I attempt to reference variable (FldToxXFM) like this:
Code: |
IF InputRoot.XML.TEST.FldToXFM = Environment.Variables.Result.SOURCE_VALUE THEN
SET OutputRoot.XML.TEST.FldToXFM = Environment.Variables.Result.TARGET_VALUE; |
It will not pick up the intended value. I know it's assigned properly - b/c if I put parenthesis around 'FldToXFM' it throws an exception with the expected
Code: |
BIP2546E: (35, 25) : (...) field type expression does not evaluate to INTEGER value; ''STATUS'' evaluates to CHARACTER. |
Status is my tag name and what FldToXFM is holding. If I hard code the 'STATUS' - it works as expected.
ANy thoughts greatly appreciated. |
|
Back to top |
|
 |
JT |
Posted: Thu Apr 08, 2004 9:11 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Can you post your ESQL code, specifically the code that sets Environment.Variables.Result.TARGET_VALUE? Have you tried setting a user trace on your message flow to confirm that Environment.Variables.Result.TARGET_VALUE is not actually set to NULL? |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Apr 08, 2004 10:08 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I think you want to use the { } instead of the ( ).
If I understand what you're trying to do. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
EddieA |
Posted: Thu Apr 08, 2004 10:08 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
You need to put {...} around the varaible to force WMQI to evaluate it. Otherwise it takes the name you have used, not the contents.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
catwood2 |
Posted: Thu Apr 08, 2004 10:09 am Post subject: |
|
|
Centurion
Joined: 17 May 2002 Posts: 108
|
JT-
I have done a Usertrace (results pasted below). Also, when it evaluates the variable with parenthesis around it - the error shows that it is indeed holding the value. And, if I hard code that value in place of the Variable - code works as expected...thx
Trace:
Code: |
(0x1000000)Variables = (
(0x1000000)Result = (
(0x3000000)XML_TAG = 'STATUS'
(0x3000000)XFM_ACTION = 'REPLACE'
(0x3000000)SOURCE_VALUE = 'On Hold'
(0x3000000)TARGET_VALUE = 'Frozen'
)
)
)
AND
(
(0x1000000)TEST = (
(0x1000000)Message_Type = (
(0x2000000) = 'GETSTABF'
)
(0x1000000)Source_Appl = (
(0x2000000) = 'UTCREM45'
)
(0x1000000)STATUS = (
(0x2000000) = 'On Hold'
)
(0x1000000)MsgTyp = (
(0x2000000) = 'GETSTABF'
)
)
) |
ESQL code for environment variable:
Code: |
SET Environment.Variables.Result[]=
(SELECT Transformation.XML_TAG, Transformation.XFM_ACTION,Transformation.SOURCE_VALUE,Transformation.TARGET_VALUE from Database.Transformation WHERE Transformation.MESSAGE_TYPE = MTYPE AND Transformation.SOURCE_APPL = SRCAPP);
SET VarAccess = Environment.Variables.Result[1]; |
|
|
Back to top |
|
 |
catwood2 |
Posted: Thu Apr 08, 2004 10:12 am Post subject: |
|
|
Centurion
Joined: 17 May 2002 Posts: 108
|
Thanks! That's what I was missing. I need to go back and find that in the ESQL manual (which, I did search before posting..erg) |
|
Back to top |
|
 |
|