I’m a beginner in RPA, I just made some easy robots, but now I have to do something for my work and I just don’t get it.
I have to get values from some rows and then print them on the excel. So I have something like this
for each row in table1
for each line table2
get variable Y
IF variable X = Variable Y
store VariableZ somewhere (i dont know if a list or an array)
but the thing is that there are going to be multiple matches, so variableX can match 3 times variableY and I have to print those 3 variableZ values in one cell.
I don’t know if I explain myself
Thanks for reading.
As per my understanding on the requirement your mentioned your post I am sharing my suggestion as below. I think we have to go for nested for each row table.
Create one string array stringarr with arraytype.
Use For each row table activity assign your First data table (assume FirstDT)
To get the VariableX= Current Row(“YourColumnNametable1”).tostring
Use another For each row table activity inside first for each and assign your second datatable (assume SecondDT)
To get variableY = CurrentRow(“Yourcolumnnameintable2”).tostring
Inside this second for each loop use one if condition and add your expression like
If → VariableX = VariableY
Then flow →
I assume variableZ is from table 2
VariableZ = CurrentRow(“Yoircolumnnamefor table2”).tostring
use Add to collection and input list is your stringarr and item should be your Varaiablez
And type argument you have to select string.
Else part leave it empty.
At the end of the flow what and all matching the variableZ will be stored in to stringarray.
I hope the above logic might helpful for your requirement. Thanks.
Thanks for your help!
I put what you said about the collection but it says the property collection of add to collection is not initialized, I search about it but I saw an example with a list
New System.Collection.Generic.List(Of String)
And I see theres no .Array, do you know how do I initialize this?
And excuse me, do you know how can I print the collection in a single excel cell?
For example the 3 matches of VariableZ needs to appear in one cell like “one two three”
Actually you devloped a flow pretty a well
Just need to add one more step
After two for each rows
If variable x= varaible y
variable z= variablez +Environment.newline+value you want to add ex:currentrow(“column1”).ToString
Thats it it will automatically append all the matched values in a single variable z
Use the variable z where you want to use in excel it will write all the matched values into single row
Hope its solves your issue
Thanks for your help!
I tried what you said but I only get the last item i found, not all.
Maybe I’m doing something wrong. I’ll check it
Thanks a lot.
can you share your flow with dummy data
Main.xaml (14.4 KB)
I made an example.
I couldnt upload the excel but I put the images of the tables, the one called “hoja2” has the result that I get, It prints just the last match instead of 123 in apple.
Maybe my mistake it’s too visible but… I can’t get it Im sorry.
Check below thread for your reference
I have a datatable as below. I want to group by using Col3 and take sum of Col2.
Col1 – Col2 – Col3 – Col4
A – 11 – AA – XYZ
B – 12 – RT – XYZ
C – 13 – HL – XYZ
D – 27 – AA – XYZ
E – 17 – AA – XYZ
F – 15 – RT – XYZ
G – 24 – HL – XYZ
Col1 – Col2
AA – 55
RT – 27
HL – 37
Please help me with the LINQ query.
@ppr @arivu96 @ClaytonM
Hope this will help you
I have modified few changes in your flow and i also attached the output with this
I it is writing the matched values in a single cell , Have a look at Matched sheet (“output sheet”)
hope its solves your issue
Update us whether you a desired solution or not
Libro2.xlsx (10.5 KB)
Main (4).xaml (15.5 KB)
I see, it’s something like that but my desired values are the ones that will print in the column “responsable” in my “Hoja2”, in the photos I put for example, in apple it only store the number 3, when I want:
and the other ones should stay where they are
I don’t know if I explain. But I will try to do it with what I saw on your flow, thank you!
Please find the attached xaml file now its working as per your requirement
Main (4).xaml (23.4 KB)
Thank you so much for your time, patience and help!!
Have a nice day. Happy New Year!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.