Skip to Content

Get corresponding Records

Hi,

I have requirement like there are two nodes Employee and dependent records.

I will get all employee records in one node and all dependent records in another node.I need to create file like it should be employee record and its dependent record in next lines. for employee and dependent records employee number is key field. How can i get corresponding dependent record using graphical mapping.

The file should look like

employee123

dependent1

dependent2

employee124

dependent1

dependent2

dependent3

dependent4

emplooyee125

dependent1

dependent2

employee126

dependent1

Dependent  should be only those dependents corresponding to employee based on employee number.

Thanks,

Ch

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Aug 13, 2012 at 02:25 AM

    Hello,

    Can you give us a sample input file?

    Regards,

    Mark

    Add comment
    10|10000 characters needed characters exceeded

    • it will be comming as

      andrew employee1 chicago USA

      charle    employee2  denver  USA

      rita          employee3  Torrance USA

      christian employee1 depemdent1 chicago USA

      Kelly        employee1 dependent2   chicago USA

      shelly      employee3 dependent1   torrace  USA

      robert      employee2 dependent1   denver USA

      Julie       employee1 dependent3   chicago usa

      mike      employee2  dependent 2  denver USA

      The target file should be like

      andrew employee1 chicago USA

      christian employee1 depemdent1 chicago USA

      Kelly        employee1 dependent2   chicago USA

      Julie        employee1 dependent3   chicago usa

      charle     employee2  denver  USA

      robert      employee2 dependent1   denver USA

      mike       employee2  dependent 2  denver USA

      rita          employee3  Torrance USA

      shelly      employee3 dependent1   torrace  USA

      Thanks,

      Ch

  • Aug 13, 2012 at 07:03 AM

    Hi Chandra,

    May be the mapping could be done by Message Mapping, but by XSL is easier. If i suppose your XML source like this:

    <?xml version="1.0" encoding="ISO-8859-1"?>

    <root>

    <node1>

    <name>andrew</name>

    <employee> employee1</employee>

    <city>chicago</city>

    <country> USA</country>

    <name>charle</name>

    <employee>employee2</employee> 

    <city>>denver</city> 

    <country>USA</country>

    </node1>

    <node2>

    <name>christian</name>

    <employee> employee1</employee>

    <dependent>depemdent1</dependent>

    <city>chicago</city>

    <country> USA</country>

    <name>Shelly</name>

    <employee>employee3</employee> 

    <dependent>depemdent1</dependent>

    <city>>torrace</city> 

    <country>USA</country>

    </node2>

    </root>

    With this XSL you could obtain easily your target XML:

    <?xml version="1.0" encoding="ISO-8859-1"?>

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

        <xsl:template match="/root">

                <xsl:copy-of select="./node1/*"/>

                <xsl:copy-of select="./node2/*"/>

        </xsl:template>

    </xsl:stylesheet>

    The target XML obtained:

    <?xml version="1.0" encoding="UTF-8"?><name>andrew</name><employee> employee1</employee><city>chicago</city><country> USA</country><name>charle</name><employee>employee2</employee><city>&gt;denver</city><country>USA</country><name>christian</name><employee> employee1</employee><dependent>depemdent1</dependent><city>chicago</city><country> USA</country><name>Shelly</name><employee>employee3</employee><dependent>depemdent1</dependent><city>torrace</city><country>USA</country>

    Regards.

    Add comment
    10|10000 characters needed characters exceeded