Rules engine Base handling round trip

Good evening guys, how are you ?

Today I have a challenge to carry out a roundtrip control and I would like your help.

I’ll give you an example of what I need to do.

Example:

I have 2 routes, the outbound and the return route.

The departure being:

RT827 - FMH-FRC-01 SOC-SP5

Being the return:

RT831 - SOC-SP5 HUB-FRC-01

Therefore, this route is a roundtrip FMH-FRC-01|SOC-SP5|HUB-FRC-01.

I would like the flow to return only those that fit this round trip pattern, and also return the IDs in 2 columns, one column for the first route and the second for the second route.

Point of attention, routes do not necessarily follow the FMH-SOC-HUB format, SOC-SOC-SOC may exist.

Example

SOC-SP2 - SOC-SP6

SOC-SP6 - SOC-SP2

I will leave the file attached, I count on your collaboration

KNIME_project4.knwf