How to iterate over all the values of a table to check a condition

Hi people,

I have a data table with the following Column Names: Supplier / Value A / Value B / Value C

I need to check if any sum of Value A + Value B + Value C is under a condition (such as sum less than 1.000). It could be from different suppliers, so a “for each row” is not the solution.

Could you give me a hint for a correct iteration over all the values of the datatable?

Thanks in advance

I think this may be what you are looking for

Hi @Josep

You can use For Each Activity but as follows:
For each row
→ Assign activity: sum = CINT(row(“Value A”)+CINT(row(“Value B”)+CINT(row(“Value C”)
→ If: sum < 1000 Then → here you can set your activities, what you want to do

best regards

Thank you!
I don’t only need the sums by row, I need every “threesome” of Value A + Value B + Value C, where the differents values could be from different suppliers.

I solved by this method:
1)Creating three List for A, B and C extracting the values from the dataTable.
2)Setting a Do While with nested IF’s for checking index of the three list, that sum in first place : A(0) + B(0) + C(0)
3) Then it sums the next C element : A(0) + B(0) + C(1)
4) Once it has summed all the elements of C, adds 1 to the index of B and set to O the C index: A(0) + B(1) + C(0), and starts again to advance over C Index.
5) etc… to finally sum A(n) + B(n) + C(n)

I hope I explained well. I would probably could find a more elegant way but it do the work I need :slight_smile:

Thanks for your answer. I found another way to solve the problem :wink:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.