cancel
Showing results for 
Search instead for 
Did you mean: 

Syntax on using Joiner XML action in a transaction

Former Member
0 Kudos

I have two XMLs of same structure..n i need to combine them.

For e.g The XMLs have the following structure:

<Rowsets>

<Rowset>

<Row>

<Col1>Name</Col1>

<Col2>Location</Col2>

</Row>

<Row>

<Col1>Name</Col1>

<Col2>Location</Col2>

</Row>

</Rowset>

</Rowsets>

I need to combine the {Rowsets/Rowset/Row} elements of the second XML after the first XML's last {Rowsets/Rowset/Row} element. I think Joiner can be used. But unable to get thru the syntax. Any help is appreciated.

Thanks

Anamika

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

HI Anamika,

You can use Union just configure Source Document 1 & 2 with your XML Inputs and take O/P of Union action.

Regards,

Manoj Bilthare

Former Member
0 Kudos

Hi Manoj,

I have already tried usin a Union action block and specified the Source1 and Source 2 with the XMLs. But getting an error [ERROR]: Union: Invalid Xml Sources

Former Member
0 Kudos

Hi,

I have tried with two XML Transaction parameter it works for me with Union on SAP MII 12.1.5.

Which Version you are using.

Regards,

Manoj Bilthare

Former Member
0 Kudos

Hi,

Iam using version 12.0.

In my BLS, I am retrieving the XMLs from 2 Queues and trying to combine them using a Union by specifying the Source1 as Queue1.Message and Source2 as Queue2.Message. However, it doesnt work.

Former Member
0 Kudos

Hi,

You can also achieve this with XPATH in assignment block

Take 1 XML type local parameter suppose XMLOP

Then take one assignment action block and assign your first xml as assign XML to XMLOP

Link Type: assign xml

Target XPATH: Local.XMOP

Expression: first XML file

after that assign

Link Type: append after xml

Target XPATH: Local.XMLOP{/Rowsets/Rowset}

Expression: your second xml file {/Rowsets/Rowset}

and use XMLOP it will join yor both xml files.

Regards,

Manoj Bilthare

Former Member
0 Kudos

Hi,

When I try to make the second assignment that you have specified, The Append After XML option is not enabled.

Former Member
0 Kudos

Hi,

Please Check wheather your xml file is like following or not

<?xml version="1.0" encoding="UTF-8"?>

<Rowsets DateCreated="2010-08-25T05:51:26" EndDate="2010-08-25T05:51:26" StartDate="2010-08-25T04:51:26" Version="12.1.5 Build(77)">

<Rowset>

<Columns>

<Column Description="Col1" MaxRange="1" MinRange="0" Name="Col1" SQLDataType="93" SourceColumn="Col1"/>

<Column Description="Col2" MaxRange="95" MinRange="88" Name="Col2" SQLDataType="8" SourceColumn="Col2"/>

</Columns>

<Row>

<Col1>Name1</Col1>

<Col2>Location1</Col2>

</Row>

<Row>

<Col1>Name2</Col1>

<Col2>Location2</Col2>

</Row>

</Rowset>

</Rowsets>

If you see above they have decleared columns in XML.

if your xml file is like this than in Joiner

map your first query op to source of parent document than second query op to child document to source

than select join type as full outer

than map same parent column name with child column name.

It workes for me hope it will help you

Regards,

Manoj Bilthare

Former Member
0 Kudos

in assignment click on show expression editor than

first you select your local param than select your xml query result than these link type will enabled automatically than type that xpath.

Regards,

manoj Bilthare

Former Member
0 Kudos

Hi Manoj,

I have tried both the options but now Iam getting the output as

<?xml version="1.0" encoding="UTF-8"?>

<Rowsets DateCreated="2010-08-25T05:51:26" EndDate="2010-08-25T05:51:26" StartDate="2010-08-25T04:51:26" Version="12.1.5 Build(77)">

<Rowset>

<Columns>

<Column Description="Col1" MaxRange="1" MinRange="0" Name="Col1" SQLDataType="93" SourceColumn="Col1"/>

<Column Description="Col2" MaxRange="95" MinRange="88" Name="Col2" SQLDataType="8" SourceColumn="Col2"/>

</Columns>

<Row>

<Col1>Name1</Col1>

<Col2>Location1</Col2>

</Row>

<Row>

<Col1>Name2</Col1>

<Col2>Location2</Col2>

</Row>

</Rowset>

<Rowset>

<Columns>

<Column Description="Col1" MaxRange="1" MinRange="0" Name="Col1" SQLDataType="93" SourceColumn="Col1"/>

<Column Description="Col2" MaxRange="95" MinRange="88" Name="Col2" SQLDataType="8" SourceColumn="Col2"/>

</Columns>

<Row>

<Col1>Name3</Col1>

<Col2>Location3</Col2>

</Row>

<Row>

<Col1>Name4</Col1>

<Col2>Location4</Col2>

</Row>

</Rowset>

</Rowsets>

However, I need the Row elements of the second xml to appended after the last Row element of the first xml. This can be achieved by applying repeater. But since I have many XMLs to combine, repeaters would cause a performance hit.

Former Member
0 Kudos

Hi,

Can I use a normalize block to achieve a single Rowset after applying the Union action?

Former Member
0 Kudos

Hi,

yes you can use Normalize action block after union

Former Member
0 Kudos

Hi,

You can use narmalise but before that you need to change the link type of assignment from Append after XML to Append XML.

have you checked your xml SQL results files they have column defination or not if they have than you can directly use joiner as i explained in my previous post.

Regards,

Manoj Bilthare

Former Member
0 Kudos

Hi , I have used Union block which returns me 2 Rowsets in the output. So I applied Normalize action, but on checking the output from Normalize, it returns only the first XML, instead of returning the single combined Rowset from the two XMLs. any idea why this might be happening?

Former Member
0 Kudos

Hi Manoj,

I do have column defintion in my XML. On using a joiner the output comes as follows

<?xml version="1.0" encoding="utf-8"?>

<Rowsets DateCreated="2010-08-25T05:50:26" EndDate="2010-08-25T05:50:26" StartDate="2010-08-25T04:50:26" Version="12.0.3 Build(107)">

<Rowset>

<Columns>

<Column Description="Col1" MaxRange="1" MinRange="0" Name="Col1" SQLDataType="1" SourceColumn="Col1"/>

<Column Description="Col2" MaxRange="1" MinRange="0" Name="Col2" SQLDataType="1" SourceColumn="Col2"/>

</Columns>

<Row>

<Col1>Name1</Col1>

<Col2>Location1</Col2>

</Row>

<Row>

<Col1>Name1</Col1>

<Col2>Location1</Col2>

</Row>

<Row>

<Col1>Name2</Col1>

<Col2>Location2</Col2>

</Row>

<Row>

<Col1>Name2</Col1>

<Col2>Location2</Col2>

</Row>

</Rowset>

</Rowsets>

instead of returning

<?xml version="1.0" encoding="utf-8"?>

<Rowsets DateCreated="2010-08-25T05:50:26" EndDate="2010-08-25T05:50:26" StartDate="2010-08-25T04:50:26" Version="12.0.3 Build(107)">

<Rowset>

<Columns>

<Column Description="Col1" MaxRange="1" MinRange="0" Name="Col1" SQLDataType="1" SourceColumn="Col1"/>

<Column Description="Col2" MaxRange="1" MinRange="0" Name="Col2" SQLDataType="1" SourceColumn="Col2"/>

</Columns>

<Row>

<Col1>Name1</Col1>

<Col2>Location1</Col2>

</Row>

<Row>

<Col1>Name2</Col1>

<Col2>Location2</Col2>

</Row>

<Row>

<Col1>Name3</Col1>

<Col2>Location3</Col2>

</Row>

<Row>

<Col1>Name4</Col1>

<Col2>Location4</Col2>

</Row>

</Rowset>

</Rowsets>

Also, while configuring the joiner, i have mapped the Source and Child documents. But how do you map the source & child columns. The dropdowns are empty.

Former Member
0 Kudos

Hi

If you map source of parent document Tag_Query_0.Results

than child document source Tag_Query_1.Results

than you can see both of your column 1 & 2 will appear there.

Regards,

Manoj Bilthare

Edited by: Manoj Bilthare on Aug 25, 2010 5:18 PM

Former Member
0 Kudos

Hi,

The issue has been resolved. Iam using a joiner. The problem was since my source and child XML passed as input to the Joiner was dynamically generated, it wasnt able to retrieve the XML structure at compile time. Hence the Source and Child columns were empty. I have harcoded the XML structure in local XML variables and passing those as input to the Joiner. That resolves the issue.