Attempting to Filter a Data Table based on Multiple Conditions

Hello,

I feel that this is worthy of its own post as I haven’t found anything similar as of yet…

Thus, I shall explain what I am trying to do.

Main Goal:

1.) Extract Structured Information from SAP Application to Data Table (Done this already)
2.) Take said Data Table and apply following logic validation:

     - Loop through each row to see if either of these 3 strings are present (Z99, 
       Y44,Y78)...Note: Only one of these will be present.
                        - IF NOT  Present:
                                          - Stop Looping as its an exception
                         - IF Present:
                                          - Take all preceding rows before the row that holds this 
                                            value.

      - Next loop through this new set of rows for the value (Z98)
                        - IF NOT Present: 
                                           - Stop Looping as its an exception
                        - IF Present:
                                            - Take all preceding rows before the row that holds this 
                                            value
     - Next loop through this new set of rows for either of these values (D42/Z80/Z66)
                       - IF PRESENT:
                                            - Stop Looping as its an exception

                       - IF NOT Present:
                                           - Take all preceding rows before the row that holds this 
                                            value
     - Next loop through this new set of rows for value (M43):
                       - IF NOT Present:
                                -  Take all preceding rows before the row that holds this 
                                    value
                       - IF Present:
                                - Not an exception but later downstream handling criteria, but t 
                                  take all preceding rows before the row that holds this value.

I tried to make it as clear as possible, but in laymans terms I am looking for a ‘Start Flag’ in this data table (Z99, Y44,Y78)…this flag will be one of the last line in the data table, after we see this start flag there should be another flag before it (Z98), if its not before it…then we stop looping. However, if it is there we then need to look if one of three flags are present before this ‘Z98’ flag (D42/Z80/Z66)…if they are present, we need to stop looping as its an exception. However, if its not present we only need to check if there is a ‘M43’ flag present before all of these…if so, its not an exception it will just have a separate handling criteria.

Hope this makes sense.

Look forward to any help.

with the new Activity filter datatable avaliable in the version 2018.3