on 02-25-2015 1:04 PM
Hi, I use MII15 and got a document having the following structure:
<?xml version="1.0" encoding="UTF-8"?>
...
<Rowset>
<Row>
<WERKS>ZZ01</WERKS>
<ORDER>001200306732</ORDER>
<WORK_CEN_LN_SEG>ST_04_01</WORK_CEN_LN_SEG>
<ROUTING_SEQ_LINE>000000</ROUTING_SEQ_LINE>
<OPER_ACT_PT>0001</OPER_ACT_PT>
<CONF_QTY>0</CONF_QTY>
<OPER_QTY>200</OPER_QTY>
<REP_DATE>0</REP_DATE>
<REP_TIME>0</REP_TIME>
<NEXT_PLNF>000000</NEXT_PLNF>
<NEXT_OPER>0005</NEXT_OPER>
</Row>
<Row>
...
I would like to only get the Row node having WORK_CEN_LN_SEG ST_04_01.
To check if my appraoch is working, I mapped XPath Output_Data.Output{/Rowsets/Rowset/Row[WORK_CEN_LN_SEG = 'ST_04_01']} to the message of a Tracer action block...But it remains emtpy:
[INFO] [Tracer_1]
As far as I understood, it should return above node as that work center is key in that document. Any idea what I am doing wrong?
Thanks for help, Marco
Hi Marco,
the XPath expression that you are using is correct. Only the way it is being used needs change.
Here-under follow the steps which can help achieving the desired results :
1. Create a local variable [eg. selNode] with type xml
2. before the tracer assign this local variable the desired XPath expression/value (You may use any existing action block or may choose to add an assignment action block for this purpose).
eg. selNode = Output_Data.Output{/Rowsets/Rowset/Row[WORK_CEN_LN_SEG = 'ST_04_01']}
3.Now in tracer, use this local xml-variable (instead of using XPath expression directly) inside the string to be assigned to the message parameter.
eg. Tracer_x.Message = "Row node having WORK_CEN_LN_SEG as ST_04_01 is : " & Local.selNode
And with this you should be able to get xml for the relevant node.
eg.
<?xml version="1.0" encoding="UTF-8"?>
<Row>
<WERKS>ZZ01</WERKS>
<ORDER>001200306732</ORDER>
<WORK_CEN_LN_SEG>ST_04_01</WORK_CEN_LN_SEG>
<ROUTING_SEQ_LINE>000000</ROUTING_SEQ_LINE>
:
:
<NEXT_OPER>0005</NEXT_OPER>
</Row>
Tracer message can be used for displaying strings and valid XML data. But as you are trying to extract and display a sub-string (/ part ) of the XML; It cannot understand and accept the node-xml as a valid xml-string, as it misses the preceding token ( <?xml version="1.0" encoding="UTF-8"?>) which helps its identification as valid XML data. And that's why tracer message does not accept/append it in the output.
regards,
Manisha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thx to everyone! Seems like my understanding of tracer abilities was wrong.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Okay, and if you are trying to use show it on tracer, you have to select a property under the row.
Like, Output_Data.Output{/Rowsets/Rowset/Row[WORK_CEN_LN_SEG = 'ST_04_01']/NEXT_OPER}
Also, you can use a repeater to get this particular row using xPath and check in tracer the current item of repeater. It will give you the exact row and would not be a toll on performance as it's just a single row.
My tracer's output:
[INFO] [Tracer_0]<?xml version="1.0" encoding="UTF-8"?><Row>
<WERKS>ZZ01</WERKS>
<ORDER>001200306732</ORDER>
<WORK_CEN_LN_SEG>ST_04_01</WORK_CEN_LN_SEG>
<ROUTING_SEQ_LINE>000000</ROUTING_SEQ_LINE>
<OPER_ACT_PT>0001</OPER_ACT_PT>
<CONF_QTY>0</CONF_QTY>
<OPER_QTY>200</OPER_QTY>
<REP_DATE>0</REP_DATE>
<REP_TIME>0</REP_TIME>
<NEXT_PLNF>000000</NEXT_PLNF>
<NEXT_OPER>0005</NEXT_OPER>
</Row>
Thanks,
Swaroop
Message was edited by: Swaroop Anasane
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marco,
Please try using below statement:
Output_Data.Output{/Rowsets/Rowset/Row[WORK_CEN_LN_SEG = "ST_04_01"]}
Else, use a repeater it would definitely work.
I have observed single quotes ' creating problem in expression editors.
Hope it helps.
Regards,
Swaroop
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't think the Tracer action will do what you want this way. There may be a better way but I usually create a Local xml property with a root node and then do an Append XML to the node with my xpath. Then you can do whatever you need with your Local property like output it with a Tracer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
4 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.