Looping multiple DataTables

Hello! Urgent help needed for following problem:

I have one datatable (DT1) containing datarows with information regarding a customers personal and overall bank information. This customer/datarow should potentially be marked with “Yes” and written into an excel sheet, depending on the result of:

Another four Datatables (DT1-4) containing True/False flags (condition is that it should be True) as well as one datatable containing an amount (string value, condition is that it is not set as “Nothing”).

Each DT could contain only one datarow each and in that case my loop works:

For each row in DT1

For each row in DT2-4
If any of the flags = true
or
For each row in DT5
If string is not "Nothing"

Mark with “Yes” in column J and write range to separate excel sheet.


My problem is that each DT could contain more than one datarow, and the only thing that matches the information together in the different DT’s is the order of the information.

What happens when there is multiple rows is that they all become “True” or not “Nothing”, even though only one of the rows being looped in DT1 has dept and contains “True” (could be one customer with multple cards and one of them has debt).

Any idea of how to fix this?

MicrosoftTeams-image (10)

MicrosoftTeams-image (9)

This is how it could look. If DT2-4 contain True/false like in the first image then the desired result would be the second image.

@agnesv

Try this :point_down:

1 Like