Data sorting and filtering

Hi there,

I need your help on sorting and filtering data.
I have this example list of data. I have to prepare this data in such a way that I then enter material “1” in the loop in a program, for example, and in the field next to it all the order numbers among themselves. then confirm entry. then the next material with all order numbers is added until all are through.


thanks as always in advance

could it be the case that you want to group the data by the Material?

1 Like

yes, thanks for the guide. i will try this same one

the description is too complicated for me. I think there is too much that I don’t need and that’s why I don’t understand it :frowning:

then do the same as others for getting a solution:

  • share input samples
  • share output samples along with described description

OK sorry . I have to explain better.

I have this basic data as input:

these should be filtered for a loop to the output:


in each circuit (loop) the material should be entered with the sales doc:

and then the next one until he has gone through all the materials:

I can enter the data. just not the filter. The sales org is not important. it’s always the same.

can be done as described in the tutorial on top:

in your case it is about:

dtMaterial= dtData.DefaultView.ToTable(True, {"Material"})

For each row | row in dtMaterial
filter activity on

then you can loop over dtFiltered again for the different Material group members

For getting a more compact modelling we can use LINQ as an alternate

Hi @juergenh1975,

You can use Group by on Material column to get the data based on groups and accordingly get the order number value and enter in SAP.


it doesn’t work for me. Can someone please take a look at what I’m doing wrong?

group_mat.xaml (10.1 KB)
mat_group.xlsx (10.9 KB)

what do I have to enter so that the material number and then all Salesdoc per loop are output?

sorry, i’m a beginner…

THX !!!

Configure the right Variable names
When calculating the distinct Material Nos - do not overwrite the original data

Your code:


Action: read range output is dtData

For the group member processing then we also include the loop over the filtered grouip members for current looped material:

it works ! Thx !

one last question:
what do I have to do if I want to give all the salesDoc per material loop in “get to clipboard” ?

Perfect, this sounds fantastic

lets try to scope the topic to only on case. Also it is unclear in which format you want to bring it.

Lets assume all Salesdocs within a string seperated by |

strAllSDs = String.Join("|", dtFiltered.AsEnumerable.Select(Function (x) x(YourColNameOrIndex).toString.Trim))

string is good, but I need you data between each other. How do I have to enter that in the assignement?

strAllSDs = String.Join("|", dtFiltered.AsEnumerable.Select(Function (x) x(YourColNameOrIndex).toString.Trim))


please reformulate the question as it is not clear.
What is needed? What is to achive?

ok, sorry :wink:

I don’t need the salesDoc separated by a " | ". The data should be entered one below the other, i.e. new line by line

as ,mentioned create a new post for your second question and let topic scope to your origin question on grouping data.

then use any other seperator char including also LineBreak like Environment.Newline
As you initial mentioned the Clipboard we would recommend to check what is supported on this by the system/field where you want to use it.

But all these details can go into the description of the new topic for this

may we ask you for closing the topic:
Forum FAQ - How to mark a post as a solution - News / Tutorials - UiPath Community Forum

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