cancel
Showing results for 
Search instead for 
Did you mean: 

CPI: Skip entry within SPLITTER

12-07-2020 1:20 PM
Christopher Participant
3493 views 6 comments Go to solution
SAP Managed Tags
Subscribe

Hey there,

I'm using the SPLITTER to split a message with several tickets IDs. For each Ticket I'll get the detail information. Based on those information I want to skip some of those tickets and don't want them to be gathered in the next step. I thought I solved it with a router in between, letting the "false" case go into an end step. But a router is not allowed betweend Splitter/Gather. What else can I do to skip some of those tickets?

Thanks,

Chris

Accepted Solutions (1)

Accepted Solutions (1)

IvoVermeer
Explorer

Simply use a Content Modifier to return an empty xml tag (whatever tag you're gathering) before the gather step. I use this approach in all flows, although I must say that I always use an xpath in my gather step. But an empty body will always to the trick.

If a single CM with an empty body doesn't work, try using two: The first sets a property that you leave empty (type constant with no value) and the second sets the body to that property (${property....})

EDIT2:

For some reason my pictures are not getting uploaded. So here's a text version:

  • A big XML with multiple employees is processed
  • I use a General Splitter to process each employee seperatly
  • For most employees, their data will be mapped to a structure of:
<employees>
  <employee>
    <field1>...</field1>
    <field2>...</field2>
    <...>
  </employee>
<employee>
  • A gather step will use XPath to create one <employees> tag with multipe <employee> tags in it(one root, multiple childs)
    Incoming Format: 'XML (same format)'
    Aggregation Algorithm: 'Combine at XPath'
    Combine from source: '/employee/employee'
    Combine at target: '/employee'

Before the gather step, I use a mapping to map my source XML to my target XML. Before that, there is a router that, based on the source XML, decides if the employee in question needs to be processed:

  • If so, it continues on to the mapping.
  • If not, it uses a content modifier that sets the body to <employees/>

That last bit will result in the gather step not 'gathering' anything because there is no <employee> tag in the body for that segment.

Even better: If for whatever reason, the steps between the splitter and gather generate an XML that does not have that structure(<employees><employee>.......</employee></employees>), it will simply be ignored and not added to the result.

I hope this helps

Answers (5)

Answers (5)

Sriprasadsbhat
Active Contributor

Hello Chris,

You can leverage Content Filter instead of Router. Refer the below blog and in the end I have showed how to use it effectively.

https://blogs.sap.com/2017/06/01/sap-cloud-platform-integration-content-filter-in-detail/

Regards,

Sriprasad Shivaram Bhat

Christopher
Participant
0 Likes

I was also not aware that we don't necessarily need the gather step! I thought it's mandatory and like an endloop step. But without it I can use a router as planned

Christopher
Participant
0 Likes

That's an example.

A ticket is valid if

ExecutionDueDate - EstimatedInternalWork(in Days) <= today

<root>
<element>
<id>3511-9-807</id>
<versionTag>6</versionTag>
<fields>
<BillingObject/>
<Classification>1</Classification>
<Description>wöchentliche Inspektion</Description>
<EstimatedInternalWork>2</EstimatedInternalWork>
<ExecutionDueDate>07.08.2020 22:00:00</ExecutionDueDate>
<Note>o Vorortbegehung und Inspektion sämtlicher baulicher und gebäudetechnischer Anlagen o Beurteilung und Bewertung der fachgerechten Installation von baulichen und gebäudetechnischen Anlagen sowie deren Betriebsverhalten o Mängel und Auffälligkeiten sind zu dokumentieren o Durchführung von Massnahmen zur Gewährleistung der integralen Sicherheit an sämtlichen baulichen und gebäudetechnischen Anlagen des Objektes zur Sicherstellung der ordnungsgemässen Funktionalität (Funktionsprüfung) • Einleitung von notwendigen inspektionsbedingten Massnahmen zur Wiederherstellung des SOLL-Zustandes wie z.B. Durchführung zusätzlicher Wartungen, Instandsetzungen, Sanierungen oder Verbesserungen</Note>
<OperatorId>0-9-30337</OperatorId>
<TicketNumber>20200804.14</TicketNumber>

</fields>

<records>
<BillingObject>
<value/>
<text/>

</BillingObject>

<Classification>
<value>1</value>
<text>Inspektion</text>

</Classification>

<Description>
<value>wöchentliche Inspektion</value>
<text>wöchentliche Inspektion</text>

</Description>

<EstimatedInternalWork>
<value>2</value>
<text>2</text>

</EstimatedInternalWork>

<ExecutionDueDate>
<value>07.08.2020 22:00:00</value>
<text>07.08.2020 22:00:00</text>

</ExecutionDueDate>

<Note>
<value>o Vorortbegehung und Inspektion sämtlicher baulicher und gebäudetechnischer Anlagen o Beurteilung und Bewertung der fachgerechten Installation von baulichen und gebäudetechnischen Anlagen sowie deren Betriebsverhalten o Mängel und Auffälligkeiten sind zu dokumentieren o Durchführung von Massnahmen zur Gewährleistung der integralen Sicherheit an sämtlichen baulichen und gebäudetechnischen Anlagen des Objektes zur Sicherstellung der ordnungsgemässen Funktionalität (Funktionsprüfung) • Einleitung von notwendigen inspektionsbedingten Massnahmen zur Wiederherstellung des SOLL-Zustandes wie z.B. Durchführung zusätzlicher Wartungen, Instandsetzungen, Sanierungen oder Verbesserungen</value>
<text>o Vorortbegehung und Inspektion sämtlicher baulicher und gebäudetechnischer Anlagen o Beurteilung und Bewertung der fachgerechten Installation von baulichen und gebäudetechnischen Anlagen sowie deren Betriebsverhalten o Mängel und Auffälligkeiten sind zu dokumentieren o Durchführung von Massnahmen zur Gewährleistung der integralen Sicherheit an sämtlichen baulichen und gebäudetechnischen Anlagen des Objektes zur Sicherstellung der ordnungsgemässen Funktionalität (Funktionsprüfung) • Einleitung von notwendigen inspektionsbedingten Massnahmen zur Wiederherstellung des SOLL-Zustandes wie z.B. Durchführung zusätzlicher Wartungen, Instandsetzungen, Sanierungen oder Verbesserungen</text>

</Note>

<OperatorId>
<value>0-9-30337</value>
<text>Stehli Kevin</text>

</OperatorId>

<TicketNumber>
<value>20200804.14</value>
<text>20200804.14</text>

</TicketNumber>


</records>


</element>


</root>
Sriprasadsbhat
Active Contributor
0 Likes

Hello Chris,

Quick question if its valid XML and you derive XPATH its easy to use Content Filter. Please share the input XML will try to help you with Condition ( for both valid or invalid ).

Regards,

Sriprasad Shivaram Bhat

Christopher
Participant
0 Likes

Hi Sriprasad,

thank you, I saw this post already. I can't use the filter because I have to do several calculations to determine if a ticket is valid or not. So I don't see how I can use the filter...

Thanks,

Chris