Author |
Message
|
hellobond070 |
Posted: Mon Nov 23, 2009 4:26 am Post subject: ESQL : Issue while Accessing variable in Environment Tree |
|
|
 Centurion
Joined: 18 Nov 2009 Posts: 118
|
Hi All,
I have an issue while accessing Environment variable.
Below is the illustration of the problem :
I pick values from Database and set the array "Datastruct" which has field "Sid109" and its corresponding value as "xxx@abc.com"
If I assign
SET TEMP= Environment.Datastruct.Sid109;
I get the correct value i.e. TEMP = xxx@abc.com
But when I assign
SET TEMPVAR=Sid109;
And then set
SET TEMP= Environment.Datastruct.TEMPVAR;
I get NULL value for TEMP and not xxx@abc.com.
I don't understand, why this substitution is not working for me ????
Any solution to this ...thanks in advance. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Nov 23, 2009 4:44 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Hi hellobond070,
Quote: |
I don't understand, why this substitution is not working for me ???? |
This would be very simple to diagnose by reading a user trace. I strongly suggest that you generate a user trace now. You will probably solve your problem in 15 minutes, and as a bonus you will have learned a really important diagnostic technique. |
|
Back to top |
|
 |
hellobond070 |
Posted: Mon Nov 23, 2009 4:53 am Post subject: |
|
|
 Centurion
Joined: 18 Nov 2009 Posts: 118
|
Hello Kimbert,
I did try everything at my end..and finally gave up...and put this query to everyone.
I tried debugging using user trace....broker assigns a NULL VALUE.
Before assinging the log says ..."Failed to navigate path element...."
I in fact used a visual debugging tool in WBIMB 6.1 and saw everything goes fine, but only when I use the "TEMPVAR" variable I get NULL value assigned.
I feel it's literally going for Environment.Datastruct.TEMPVAR when it actually should be looking for Environment.Datastruct.TEMPVAR.Sid109
This looks to be a simple problem...yet m not able to resolve this issue  |
|
Back to top |
|
 |
kimbert |
Posted: Mon Nov 23, 2009 4:59 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Fair enough. Sorry for suggesting something that you already tried. But you didn't *say* that you had tried it...
Best way forward would be to post the relevant part of the user trace. |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Nov 23, 2009 5:03 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Don't double Post. It is considered rude
http://www.mqseries.net/phpBB2/viewtopic.php?t=51646
Take a look at my reply to your original post. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
hellobond070 |
Posted: Mon Nov 23, 2009 5:27 am Post subject: |
|
|
 Centurion
Joined: 18 Nov 2009 Posts: 118
|
I m sorry for the inconvenience Davies99 for double Post...Appreciate your effort..Thanks.
Below is the log user trace :
Executing statement ''SET TEMP1 = TRIMBOTH(BOTH FROM CAST(TEMP AS CHARACTER));'' at ('XXXYYY_ERROR_Compute.Main', '30.3').
Evaluating expression ''TEMP'' at ('XXXYYY_ERROR_Compute.Main', '30.25'). This resolved to ''TEMP''. The result was '''Sid109'''.
Evaluating expression ''CAST(TEMP AS CHARACTER)'' at ('XXXYYY_ERROR_Compute.Main', '30.20'). This resolved to ''CAST('Sid109' AS CHARACTER)''. The result was '''Sid109'''.
Evaluating expression ''TRIMBOTH(BOTH FROM CAST(TEMP AS CHARACTER))'' at ('XXXYYY_ERROR_Compute.Main', '30.15'). This resolved to ''TRIMBOTH('Sid109', NULL)''. The result was '''Sid109'''.
Executing statement ''SET TOEmail = Environment.TEMPVAR.TEMP1;'' at ('XXXYYY_ERROR_Compute.Main', '31.3').
('XXXYYY_ERROR_Compute.Main', '31.17') : Failed to navigate to path element number '3' because it does not exist.
Evaluating expression ''Environment.TEMPVAR.TEMP1'' at ('XXXYYY_ERROR_Compute.Main', '31.17'). This resolved to ''Environment.TEMPVAR.TEMP1''. The result was ''NULL''.
Executing statement ''SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*:*.(XMLNSC.Attribute)Version = '1.0';'' at
The scenario I explained was to make everybody undersand the issue. Actually I m trying to read the input coming XML field data whose value is Sid109 as of now. But this value wud keep changing and the corresponding email id wud be picked frm the database table. As of now i m trying with this value.
I m assigning this value to TEMP1 as evident from the usertrace log and ''Environment.TEMPVAR.TEMP1'' should fetch me the required email id since TEMPVAR array has already been populated with database values.
I hope I am clear...Waiting for replies |
|
Back to top |
|
 |
Herbert |
Posted: Mon Nov 23, 2009 5:43 am Post subject: |
|
|
 Centurion
Joined: 05 Dec 2006 Posts: 146 Location: Leersum, The Netherlands
|
hellobond070 wrote: |
I m assigning this value to TEMP1 as evident from the usertrace log and ''Environment.TEMPVAR.TEMP1'' should fetch me the required email id since TEMPVAR array has already been populated with database values. |
Is this perhaps inside an error handling you have connected to the Failure terminal? The Failure terminal starts with a clean Environment. |
|
Back to top |
|
 |
hellobond070 |
Posted: Mon Nov 23, 2009 5:45 am Post subject: |
|
|
 Centurion
Joined: 18 Nov 2009 Posts: 118
|
Hello Herbert,
No, this isn't connected to the failure terminal. |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Nov 23, 2009 5:49 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
I get what you are trying to do.
You are trying to create a dynamic field name reference to your daya tree.
you say the the name of the field which is currently Sid109 might change but you still want to get the data.
You can get the field name by using the .FieldName option.
Create a reference to Environment.DataStruct
Then you can navigate down the list of fields and select the right one using the .FieldName option.
This type of abstraction is not easy in ESQL and might not be worthwhile. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Herbert |
Posted: Mon Nov 23, 2009 5:50 am Post subject: |
|
|
 Centurion
Joined: 05 Dec 2006 Posts: 146 Location: Leersum, The Netherlands
|
hellobond070 wrote: |
No, this isn't connected to the failure terminal. |
In that case you did not set Environment.TEMPVAR.TEMP1 , show the code and trace where you did set this. |
|
Back to top |
|
 |
hellobond070 |
Posted: Mon Nov 23, 2009 5:51 am Post subject: |
|
|
 Centurion
Joined: 18 Nov 2009 Posts: 118
|
I guess the problem is TEMPVAR not getting subtituted with Sid109. I even tried FIELDVALUE(Environment.Datastruct.TEMPVAR) function but in vain.
Quote: |
Below is the illustration of the problem :
I pick values from Database and set the array "Datastruct" which has field "Sid109" and its corresponding value as "xxx@abc.com"
If I assign
SET TEMP= Environment.Datastruct.Sid109;
I get the correct value i.e. TEMP = xxx@abc.com
But when I assign
SET TEMPVAR=Sid109;
And then set
SET TEMP= Environment.Datastruct.TEMPVAR;
I get NULL value for TEMP and not xxx@abc.com. |
|
|
Back to top |
|
 |
Herbert |
Posted: Mon Nov 23, 2009 5:56 am Post subject: |
|
|
 Centurion
Joined: 05 Dec 2006 Posts: 146 Location: Leersum, The Netherlands
|
smdavies99 wrote: |
I get what you are trying to do.
You are trying to create a dynamic field name reference to your daya tree.
you say the the name of the field which is currently Sid109 might change but you still want to get the data.
You can get the field name by using the .FieldName option.
Create a reference to Environment.DataStruct
Then you can navigate down the list of fields and select the right one using the .FieldName option.
This type of abstraction is not easy in ESQL and might not be worthwhile. |
ok, now I understand, I have done something in the past, not sure about the syntax, it's something like below:
SET TEMPVAR = 'Sid109';
SET TEMP = Environment.Datastruct.{TEMPVAR};
hgj |
|
Back to top |
|
 |
hellobond070 |
Posted: Mon Nov 23, 2009 5:56 am Post subject: |
|
|
 Centurion
Joined: 18 Nov 2009 Posts: 118
|
Hello Herbert,
I did set the Environment variable. Environment gets set using a function which I call which fetchces several values including email value for Sid109 when called.
In fact my problem illustration clearly states the fact that setting of environment is working and the issue is with ESQL code.
Quote: |
If I assign
SET TEMP= Environment.Datastruct.Sid109;
I get the correct value i.e. TEMP = xxx@abc.com |
The problem is in the second scenario using a variable
Quote: |
But when I assign
SET TEMPVAR=Sid109;
And then set
SET TEMP= Environment.Datastruct.TEMPVAR;
I get NULL value for TEMP and not xxx@abc.com. |
|
|
Back to top |
|
 |
hellobond070 |
Posted: Mon Nov 23, 2009 6:04 am Post subject: |
|
|
 Centurion
Joined: 18 Nov 2009 Posts: 118
|
Hello Herbert,
Hurrrrrrrrrrrrrrrrrrrrayyyyyyy...it's working now....Thankssssssssss a lot HERBERT!!
Thanks smdavies99 and Kimbert !!!!!!!!!!
SOLUTION !!!!!!!!!
Quote: |
SET TEMPVAR = 'Sid109';
SET TEMP = Environment.Datastruct.{TEMPVAR}; |
|
|
Back to top |
|
 |
|