Hi Team,
I have some 130 rows in excel but i need to copy first 4 rows from excel and paste it in SAP and again i have to copy next 4 rows from 5th row and again i have to copy next 4 rows frm wer it stopped…how do i achieve this
Hi Team,
I have some 130 rows in excel but i need to copy first 4 rows from excel and paste it in SAP and again i have to copy next 4 rows from 5th row and again i have to copy next 4 rows frm wer it stopped…how do i achieve this
Assumption: Project is set to Windows Compatibility
Assign Actvitiy
SegmentTables | List(Of DataTable) =
dtDataVar.AsEnumerable.Chunk(4).Select(Function (x) x.CopyToDataTable).toList
We split the origin DataTable into a List of smaller DataTables
Assign: currentIndex = 1
While currentIndex <= dt.Rows.Count
Assign: rowsToCopy = dt.AsEnumerable().Skip(currentIndex - 1).Take(4).CopyToDataTable()
// Assuming dt is your DataTable variable containing the Excel data
// Copy the rows from 'rowsToCopy' and paste them into SAP
// Update currentIndex for the next iteration
Assign: currentIndex = currentIndex + 4
End While
Hi Thanks for ur reply, but i am getting the same list everytime even after 4th row is fetched, please find below FYR.
Hi Thanks for ur reply, sorry to ask u this, can u please brief it? like after splitting it hw do i paste it in SAP ?
in general you would loop over the List of segmented Datatables and work within each iteration with the four Data Rows
depends on how the information is to place into SAP. Feel free to elaborate more on this and share with us details on this part
Sequence10.zip (2.2 KB)
I hope this helps you
Hi Thank you
this is working fine but while pasting into sap, it is also pasting column name even though i had removed add headers.
we would assume that you used a output DataTable or similar to create the content which you want to place within the SAP
Any Part results you can check with inspections e.g. immediate panel
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum
As an alternate flow check:
Assign Actvitiy
SegmentTables | List(Of DataTable) =
dtDataVar.AsEnumerable.Chunk(4).Select(Function (x) x.CopyToDataTable).toList
For each activity (not for each row activity) - Type Argument: DataTable
For each | tbl in SegmentTables
String.Join(Environment.Newline, tbl.AsEnumerable.Select(Function (x) x("Column0").toString.Trim))
DT.AsEnumerable.Chunk(4).Select(Function (x) x.CopyToDataTable).ToList
currentItem.DefaultView.ToTable(True,"Column0")
Then you can simply paste in SAP
Hope it will helps you
Cheers!!