cancel
Showing results for 
Search instead for 
Did you mean: 

How to filter records for sending

Former Member
0 Kudos

Hi Exports

I need your valuable advice on following issue please

We are sending multiple records together to the target, want to filter records if any field is empty. How can we achieve this. I tried with XPath in Receiver Determination but it skipping whole message if condition meets.

example:

<ADRInfo>

<Record>20122</Record>

     <Address> 101 Anderson St</Address>

     <City> New York </City>

     <State> NY </State>

<Record>202345</Record>

     <Address> </Address>

     <City> </City>

     <State> </State>

<Record>223423</Record>

     <Address>201 Fred Blvd </Address>

     <City>Kentuky</City>

     <State>KY</State>

</ADRInfo>

I want skip <Record>202345></Record> (because of City and Sate is empty) and send other 2 records, mapping is simple one to one.

How can this condition achieved, I don't think we can do it in mapping.

Thanks in advance

Vasu

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Vasu,

You can also achieve using graphical mapping...

<Address> node-->removecontext -->string length-->greater [than constant 0]-->ifwithoutElse [then <record> node] ---> <Recode> node

Like this include  <city> and <street> node using OR boolean operator before mapping ifWithoutelse function.

Rest all 1.1 mapping.

This will give only those <Record>nodes which has values in <address>, <city> and <street>

Thanks

Ray...

rajasekhar_reddy14
Active Contributor
0 Kudos

using standard mapping functions you can frame mapping logic .

like check the all field values are emtpy or not using text equls functions and AND fucntion.

Former Member
0 Kudos

Hi Vasu,

You can write an XSLT code to check for the empty child tags and remove the respective parent node.

import the xsl under Imported Archives and in Operation mapping, use the same after adding your one to one mapping objects.

Thanks

Ray..

nabendu_sen
Active Contributor
0 Kudos

Hi,

You have to write a Java UDF to populate target <Record> node. The UDF will take 4 inputs Record, Address, City and State and type will be All values the Queue. First need to check whether Record is populated in Source for a particular occurrence and  then check whether any of the value under it is missing or not. If everything is present then result.addValue(""), otherwise just skip it. The rest of the fields will be 1-1 mapping.

Thanks,

Nabendu.