cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

XI Mapping- Filter rows based on source field value

Former Member
0 Likes
811

Hi I am trying to insert rows into a database. From all the rows in the source structure i will need to pick rows based on a source field, if the source field value matches a certain value 'WA' then that row needs to be mapped to the access structure of the target.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Vinay,

First of all read the file into XI.

Then you map your condition with createif to the root node of the target ie.,

Condition>createif>target root node.

So if the condition is true then only your target node will be created.

If this doesnot work due to multiple structures then another option I have is to do multiple mappings. So in the first mapping you send the whole row into XI. Then you parse it up and send the good records to the target. Then you in the second mapping you just map to the target.

---Satish

Answers (2)

Answers (2)

justin_santhanam
Active Contributor
0 Likes

Vinay,

Can you give the sample source payload - structure.

Best regards,

raj.

Former Member
0 Likes

Raj

Attached are the sample payloads i created to simulate my problem.

Source:

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

<ns0:test1 xmlns:ns0="urn:cop-city:test">

<row>

<parm1>C</parm1>

<parm2>1</parm2>

<parm3>10</parm3>

</row>

<row>

<parm1>A</parm1>

<parm2>2</parm2>

<parm3>20</parm3>

</row>

<row>

<parm1>Z</parm1>

<parm2>3</parm2>

<parm3>30</parm3>

</row>

<row>

<parm1>A</parm1>

<parm2>4</parm2>

<parm3>40</parm3>

</row>

</ns0:test1>

Result: after using satish's condition... Check if parm1 is equal to 'A' then createif.

But i had to change the context of parm1 to higher level.

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

<ns0:test2 xmlns:ns0="urn:cop-city:test">

<stmt>

<access>

<parm2>2</parm2>

<parm3>20</parm3>

</access>

<access>

<parm2>4</parm2>

<parm3>40</parm3>

</access>

</stmt>

</ns0:test2>

Satish thanks for thesuggestion.

VijayKonam
Active Contributor
0 Likes

Thats a good idea given bby Satish. Also, you might want to create UDF if things really seems to be clumsy in graphical tool (Assumption is you know the basic java for writing the UDF).

VJ