cancel
Showing results for 
Search instead for 
Did you mean: 

CPI: Skip entry within SPLITTER

12-07-2020 1:20 PM
Christopher Participant
3492 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

View Entire Topic
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