Author |
Message
|
LH33 |
Posted: Mon Mar 24, 2003 7:58 am Post subject: How to use a Tag Name as an Error Description ? |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
HI!
I have a message flow where I need to put a Tag name as a text Error Description. This tag name will always be in the same place, but will have different values depending on errors. Is there a way to code it so that I can always put that tag in my error description output field. I have included the XML and bolded the tag that I want. The tag will always be after the closing tag of </Original ApplicationArea>
Thanks for any help you can provide!! LiasB
[<ConfirmJob revision="1.0.0" environment="Test">
<ApplicationArea>
<Sender>
<Component>Identify The Application Of Origin</Component>
<Confirmation>Never</Confirmation>
<AuthorizationId>Identify The User Of Origin</AuthorizationId>
</Sender>
<CreationDateTime>CCYY-MM-DDThh:mm:ss</CreationDateTime>
<BODId>GUID - Globally Unique Identifier</BODId>
</ApplicationArea>
<DataArea>
<Confirm/>
<Job>
<Header>
<OriginalApplicationArea>
<Sender>
<Component>OriginalBOD.Component</Component>
<Confirmation>OriginalBOD.Confirmation</Confirmation>
<AuthorizationId>OriginalBOD.AuthorizationId</AuthorizationId>
</Sender>
<CreationDateTime>OriginalBOD.CreationDateTime</CreationDateTime>
<BODId>OriginalBOD.BODId</BODId>
</OriginalApplicationArea>
<CreateSuccess>
<JobNumber>1234</JobNumber>
</CreateSuccess>
</Header>
</Job>
</DataArea>
</ConfirmJob>
][/code] |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Mar 24, 2003 8:58 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
This code:
Code: |
declare myRef REFERENCE TO OutputRoot.XML.ConfirmJob.DataArea.Job.Header.OriginalApplicationArea;
move myRef NEXTSIBLING;
set Environment.Variables.Test = FIELDNAME(myRef); |
gave me this in a trace file:
Code: |
Environment
(
(0x1000000)Variables = (
(0x3000000)Test = 'CreateSuccess'
)
) |
This is with WMQI 2.1, CSD04. |
|
Back to top |
|
 |
LH33 |
Posted: Mon Mar 24, 2003 9:13 am Post subject: |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
Thank you!! I'm trying your code now!! |
|
Back to top |
|
 |
LH33 |
Posted: Mon Mar 24, 2003 10:18 am Post subject: |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
The suggested code works great! Now I need a way to reference the bolded tag below to move it to an output tag. The value in the NEXTSIBLING tag will vary, but the bolded tag will always be there. Examples of the NEXTSIBLING tag are "CreateSuccess', 'ChangeSuccess', and 'CloseSuccess'. For each of these there will be a <JobNumber> associated with it that I need to move to an output field. Is there a way to reference the <JobNumber> tag without hard coding the value of NEXTSIBLING?
Thanks for any help!!! LisaB
<CreateSuccess>
<JobNumber>1234</JobNumber>
</CreateSuccess> |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Mar 24, 2003 10:38 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Well, in your example, the Job Number would actually be the FIRSTCHILD of your CreateSuccess tag, and not it's next sibling.
You could either move the reference to the FIRSTCHILD in order to point to your job number tag:
Code: |
MOVE myRef FIRSTCHILD; |
create a new reference that points to the first child of your reference:
Code: |
declare newRef REFERENCE TO myRef.*[1]; |
Or explicitly reference it either by position or name:
Code: |
set OutputRoot.XML.OutputMessage.JobNumber = myRef.*[1]; |
or
Code: |
set OutputRoot.XML.OutputMessage.JobNumber = myRef.JobNumber; |
Chapter 2 of the ESQL Reference manual has more information about accessing fields using anonymous references.
Last edited by jefflowrey on Mon Mar 24, 2003 10:53 am; edited 1 time in total |
|
Back to top |
|
 |
LH33 |
Posted: Mon Mar 24, 2003 10:42 am Post subject: |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
|
Back to top |
|
 |
|