Skip to Content
0

How to remove the record(XML) based on some condition.

Apr 16, 2017 at 05:38 PM

84

avatar image

Hi All,

I want to Remove record from XML based on input field values.

Is this Possible through XSLT mapping?.

Regards,

Aditya

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Evgeniy Kolmakov Apr 17, 2017 at 07:03 AM
0

Hi Aditya!

You can apply template to source document which copies only elements that fit your condition. Thus, unwanted records will be skipped.

Regards, Evgeniy.

Share
10 |10000 characters needed characters left characters exceeded
Sriprasad Shivaram Bhat Apr 17, 2017 at 09:51 AM
0

Hello Aditya,

Agree with evegniy.From SAP HCI perspective you can use Content Filter which might fit into your requirement instead of writing XSLT to perform the same.

Below example might help you.

Goal is to pull Active employees from India who are permanent.

Condition in Content Filter:

Input XML:

<?xml version="1.0" encoding="UTF-8"?>
<EmployeeData>
    <Record>
        <PersonID>1000</PersonID>
        <UserID>31</UserID>
        <EmployementID>E221</EmployementID>
        <Status>A</Status>
        <Country>IND</Country>
        <Contractor>No</Contractor>
    </Record>
    <Record>
        <PersonID>1001</PersonID>
        <UserID>32</UserID>
        <EmployementID>E222</EmployementID>
        <Status>T</Status>
        <Country>SGP</Country>
    </Record>
    <Record>
        <PersonID>1002</PersonID>
        <UserID>33</UserID>
        <EmployementID>E223</EmployementID>
        <Status>A</Status>
        <Country>CAN</Country>
    </Record>
    <Record>
        <PersonID>C1003</PersonID>
        <UserID>C34</UserID>
        <EmployementID>C224</EmployementID>
        <Status>A</Status>
        <Country>IND</Country>
        <Contractor>Yes</Contractor>
    </Record>
</EmployeeData>

Output XML:

<Record>
        <PersonID>1000</PersonID>
        <UserID>31</UserID>
        <EmployementID>E221</EmployementID>
        <Status>A</Status>
        <Country>IND</Country>
        <Contractor>No</Contractor>
 </Record>

You can have Content Modifier after Content Filter and rebuild the XML with root node [ Having EmployeeData as root node ]

Regards,

Sriprasad Shivaram Bhat


Share
10 |10000 characters needed characters left characters exceeded