ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Accessing a complex type value via ESQL language

Post new topic  Reply to topic Goto page 1, 2  Next
 Accessing a complex type value via ESQL language « View previous topic :: View next topic » 
Author Message
visasimbu
PostPosted: Thu Nov 04, 2010 2:49 am    Post subject: Accessing a complex type value via ESQL language Reply with quote

Disciple

Joined: 06 Nov 2009
Posts: 171

Hi,

I have input message in below specifed format.

<TS>2009-10-01<CURRENTDATE>12/29/2009</CURRENTDATE>
<CURRENTTIME>10:15:30</CURRENTTIME>
</TS>

look closely we have the value for the complex tag 'TS'.
I want to access the value (2009-10-01) in complex tag via the ESQL language.
When i try the 'Root.TS' this one it takes tag currentdate and current time tag too. So i could not access the value.

Any help will be appreciated.
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Thu Nov 04, 2010 4:06 am    Post subject: Re: Accessing a complex type value via ESQL language Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

visasimbu wrote:
When i try the 'Root.TS' this one it takes tag currentdate and current time tag too. So i could not access the value.


Post your ESQL. If having thought carefully about what you're doing you haven't spotted the issue.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Nov 04, 2010 5:40 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Post a trace node output showing the parsed message structure.

If you think carefully about the results, you'll know better how to write your ESQL.
Back to top
View user's profile Send private message
sanp07
PostPosted: Thu Nov 04, 2010 7:04 am    Post subject: you the below code to get the value.... Reply with quote

Newbie

Joined: 04 Nov 2010
Posts: 2
Location: FL,US

Use this....It will work....

SET OutputRoot.XML.DATE1.VALUE= SUBSTRING(InputRoot.XML.TS FROM 1 FOR 10);
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Nov 04, 2010 7:09 am    Post subject: Re: you the below code to get the value.... Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

sanp07 wrote:
Use this....It will work....

SET OutputRoot.XML.DATE1.VALUE= SUBSTRING(InputRoot.XML.TS FROM 1 FOR 10);


No, don't use this.

It will do nothing of use and should not be using XML domain in the first place.
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Nov 04, 2010 7:23 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

visasimbu : You need the FIELDVALUE function.

sanp07 : Don't post wrong advice, please. It confuses people.
Back to top
View user's profile Send private message
sanp07
PostPosted: Thu Nov 04, 2010 8:46 am    Post subject: Reply with quote

Newbie

Joined: 04 Nov 2010
Posts: 2
Location: FL,US

If we use FIELDVALUE function it gives the total value in between <TS> ....</TS> Including CURRENTDATE AND CURRENTTIME. Sorry if there is any other way of using FIELDVALUE FUNCTION...Thanks.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Nov 04, 2010 8:59 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

sanp07 wrote:
Sorry if there is any other way of using FIELDVALUE FUNCTION...Thanks.


There's only one way. If you've got some sample code of it demonstrating this behaviour please post in (using code tags if you will)
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Nov 04, 2010 9:03 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

mqjeff wrote:
Post a trace node output showing the parsed message structure.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Nov 04, 2010 9:33 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

mqjeff wrote:
mqjeff wrote:
Post a trace node output showing the parsed message structure.



_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
visasimbu
PostPosted: Fri Nov 05, 2010 12:15 am    Post subject: Reply with quote

Disciple

Joined: 06 Nov 2009
Posts: 171

Hi all,

thanks for immediate reply. I try to explain more detail. I am using 6.1 WMB Toolkit.

See my input message below

<EMP>
<TS>
2009-10-01
<CURRENTDATE>12/29/2009</CURRENTDATE>
<CURRENTTIME>10:15:30</CURRENTTIME>
</TS>
</EMP>

I have one input node, compute node and followed by output node. In compute node i want to set the value of '2009-10-01' in my environment variable. So i tried below thing.

SET Environment.variable.temp = InputRoot.XMLNSC.EMP.TS;

Above code is not doing the expected thing.

So i set the debug point immediate after the input node and seen my input message structure. It was amazing my data under TS becomes as below thing.

TS
CURRENTDATE:CHARACTER:12/29/2009
CURRENTTIME:CHARACTER:10:15:30

The data under TS value got lost ( i.e 2009-10-01) while parsing.

I dont know what is going on. Kindly help me in this situation.
Back to top
View user's profile Send private message Send e-mail
smdavies99
PostPosted: Fri Nov 05, 2010 12:40 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

I think the OP is talking about this.
If you take this input Message.

Code:

<TS>
 2009-10-01
 <CURRENTDATE>12/29/2009</CURRENTDATE>
 <CURRENTTIME>10:15:30</CURRENTTIME>
</TS>


And use this ESQL
Code:

   CREATE PROCEDURE DoStuff() BEGIN
      DECLARE InRef REFERENCE to InputRoot.XML;
      SET OutputRoot.XMLNSC.Data.Value_1 = FIELDVALUE(InRef.TS);
      SET OutputRoot.XMLNSC.Data.Value_2 = FIELDVALUE(InRef.TS.CURRENTDATE);
      SET OutputRoot.XMLNSC.Data.Value_3 = FIELDVALUE(InRef.TS.CURRENTTIME);
   END;

you get this at a trace node placed after the MQInput Node
Code:

(0x01000000:Folder):XMLNSC     = ( ['xmlnsc' : 0x999d700]
  (0x01000000:Folder):TS = (
    (0x03000000:PCDataField):CURRENTDATE = '12/29/2009' (CHARACTER)
    (0x03000000:PCDataField):CURRENTTIME = '10:15:30' (CHARACTER)
  )
)

Then you get this after the Compute Node
Code:
                                       
(0x01000000:Folder):XMLNSC     = ( ['xmlnsc' : 0x999e1c8]
  (0x01000000:Folder):Data = (
    (0x03000000:PCDataField):Value_2 = '12/29/2009' (CHARACTER)
    (0x03000000:PCDataField):Value_3 = '10:15:30' (CHARACTER)
    )
  )   


If you change the MQInput node to use the depreciated XML Parser you get this at the Trtace node
Code:
                                     
(0x01000010:ParserRoot):XML        = ( ['xml' : 0x2558400]
   (0x01000000:Element):TS = (
      (0x02000000:pcdata ):            = '2009-10-01' (CHARACTER)
      (0x01000000:Element):CURRENTDATE = (
        (0x02000000:pcdata): = '12/29/2009' (CHARACTER)
      )
      (0x01000000:Element):CURRENTTIME = (
        (0x02000000:pcdata): = '10:15:30' (CHARACTER)
     )
    )
  )
)   

Then the output message looks like this
Code:

<Data>
 <Value_1>2009-10-01</Value_1>
 <Value_2>12/29/2009</Value_2>
 <Value_3>10:15:30</Value_3>
</Data>                               

Which I assume is what he wants.
_________________
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
View user's profile Send private message
rekarm01
PostPosted: Fri Nov 05, 2010 12:57 am    Post subject: Re: Accessing a complex type value via ESQL language Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

Read here and here.

If that doesn't work ...
Vitor wrote:
mqjeff wrote:
mqjeff wrote:
Post a trace node output showing the parsed message structure.
Back to top
View user's profile Send private message
mgk
PostPosted: Fri Nov 05, 2010 1:06 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

By default the XMLNSC parser throws away mixed content (which is what is in the input message). However, you can set the option to tell the XMLNSC parser to 'retain mixed content' on the Input node...

Kind Regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
visasimbu
PostPosted: Fri Nov 05, 2010 6:32 am    Post subject: Reply with quote

Disciple

Joined: 06 Nov 2009
Posts: 171

Thank you smdavies99 ,rekarm01 & mgk.

smdavies99,
Do u know the difference between depreciated XML Parser and XMLNSC (XMLNSC : For XML messages (namespace aware, validation, low memory use)). I could not find the difference in help content.
I am going to using this solution in existing project. I dont want to disturb the existing code by changing XMLNSC to XML.

Though when i use depreciated XML Parser it copies value with /n (newline) from the input to the output field Value_1 like below.

<Value_1>. 2009-10-01. . .</Value_1> (copied from RFHUTIL tool)

Input :

<TS>
.. 2009-10-01..
<CURRENTDATE>12/29/2009</CURRENTDATE>
<CURRENTTIME>10:15:30</CURRENTTIME>
</TS>

Do u have any idea to avoid the newline (/n) from input ?

Hi rekarm01 & mgk.

When i use 'retain mixed content' alone in input message parser. It was parsing successfully and i can see the values before my compute node. But i dont know how to copy the values from the input field to output field. I tried below things though i could not achieve it.

SET OutputRoot.XMLNSC.Data.Value_1 = TRIM(FIELDVALUE(InRef.TS));
SET OutputRoot.XMLNSC.Data.Value_2 = InRef.TS;

Do u have any idea to copy the values from input message (given above) to output message ?
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Accessing a complex type value via ESQL language
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.