Help with for each datarow loop

hi all,

i have a problem with a test i am trying to run. i am running a for each data row loop inside another each data row loop.

what i have is a tale called dt_source and then i need to extract the unique values for the column CP_SERVICE - consider it a reporting group.

then i need to loop through the source table with each unique CP_SERVICE that will group the survives (eg all rows where the service of cp1, cp2, cpe3 etc) together and create a text file that i will use for an email.

i can see that all the unique cp services are being created
Also i can see that it processed the details for cp1 correctly - (i know in the example that i have here that it repeats the process afew times but i am ok with that for now)
but it does not process anything for cp2 or cp3, or write anything for them to the text file

if i change cp1 to cp4 the the files for cp2 will be processed instead

any help to get the file working for cp2 and cp3 would be greatly appreciated

workflow is attached and source file is attached

thanks,
Source.xlsx (12.0 KB)

Main.xaml (19.8 KB)

some parts could be avoided (e.g. heavy dt text outputting, as we can do inspections with the debugging panels)

We would recommend to use for the filter output a seperate variable: dtFiltered
grafik

As a group by is implemented also have a look here:

Maybe you want to shift to a groupby LINQ

in the actual workflow i dont have the outputs or write text files. it is there in this example just to show that the dat should be there, just is not being picked up correctly

i will have a look at the grouped by linq and see how i get on with it

thanks

so i had a look at the group by with linq and i just cannot get it work work. i tided up my workflow a bit and got rid of the repeating rows but it still will not bring in any unique cp after the first one processed

i feel that something very minor is wrong, just can not find it

image
Main.xaml (20.0 KB)
Source.xlsx (12.0 KB)

when referring to your input what is the expected output?

the inputs are cp2, cp3 and cp4

output should be - what you see in the second loop for cp2, being repeated for cp3 and cp4

for cp3 and cp4 i can see that they are being registered an input - but not being fed into the second loop

we avoid misinterpretations when you share the output samples. Thanks

no problem at all - this is the correct output for cp2

image

just trying to get the same result for cp3 and cp4 currently neither are making it correctly into the second loop

@adrian_sullivan

Rather than log message showing thw input file and the output file or the process flow would help

Cheers

the process is attached form 30 mins ago along with the source file

@adrian_sullivan

If you need all cp_service one oafter the other…then first use sort datatable with cp_service as column and then loop theough

Cheers

Yes this is correct

But we also got told:

So we assume that there is a risk of used / development and this sample XAML can be inconsistent / different

As we told:

But cannot see any adaptions on the second XAML we dont know what was done in real

With a feedback of:

we also dont know what was done at this part in detauls and still cannot derrive any details on result and difference on the expected output

Additional: we do see a few hints on the creation of HTML code in a way which also can be done different and more clean/straightforward.

So all in all, there is a risk on misinterpretations on what is needed

We also agree to

as a few hints are given and maybe the from your end DefaultView & Filter DataTable (a typical GroupBy style) maybe is not needed.

So to close and giving some hints on the possible next actions

  • check what was aimed: data grouping or filtering
  • check on e.g. Activities like Create HTML Content / Custom Packages which can simplify the dataTable to HTML Table tr/td generation part.

so finally figured it out

the problem was with my filter in the first loop
image

i was setting it lo look at only cp2 - which it was doing

then in loop 2 i was looking in dt_source - with the filter of cp2
when loop 2 ran for cp3 or cp4 it could not find anything as it was already filtered for cp2

so i had to go back to the first filter and created a temp dt - dt_sourcex

that when when entered loop 2 it could filter correctly and find cp3 and cp4 (as the full dataset was there)
image

to give me the expected output of

i knew it was something small - just took me more time than i care to admit to find what it was…

thanks for the help and pointing me in the right direction

1 Like

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