Hi Team,
Input:
items=‘H44942LZ’,‘H44952LJ’,‘H44952LA’,‘H43222LB’,‘H44952LB’,‘H44952LC’,‘H44952LD’,‘H44952LJ’,‘H44942LZ’,‘H44952LA’,‘H44952LA’,‘H44952LC’,‘H44952LC’,‘H44952LC’,‘H44952LC’,‘H44952LJ’,‘H44942LZ’,‘H44952LC’,‘H44952LC’,‘H43222LB’,‘H43222LB’,‘H44952LA’,‘H44952LB’,‘H44952LD’,‘H44952LA’
items is a string variable
for example if i have 500 items in Items Variable i need to divide it into 50 items and enter 50 items in the textbox in application and download the report and enter 2nd 50 items in the same text box in application and download the second report in same way untill 500 items completed
each set should be 50 items
Please provide solution
Thanks
Likitha
Hi @vinjam_likitha ,
There may be different solutions, but my suggestion would be to use the mod operator within an if statement inside a for loop. Every 50 iterations, the can enter the if block to download the report and reset the page to its logged-in state. I hope this gives you an idea.
Regards,
MY
ppr
(Peter Preuss)
April 14, 2023, 1:13pm
3
we can split the string e.g. when like above
arrPart = item.Split(","c).Select(Function (x) x.Trim({"'"c})).toArray
First Segment
arrSplit = arrSplits .Skip(0*50).Take(50).toArray
Second Split:
arrSplit = arrSplits .Skip(1*50).Take(50).toArray
…
With variables and some other techniques, we can fully dynamize it
@christine.tzenghy
let me introduce a general approach that can be also adopted to more case specific details.
Assumptons:
DataTable with 8 Rows
Segmentsize: 3
Following Building Blocks are used
Calculation of the numbers of segments:
[grafik]
with the Ceiling method the fractions are uprounded to the next Integer
with the Skip() and Take() Method the Rows for a segment can be retrieved.
the different segments are bult by following
[grafik]
and do fetch the different segment rows by: …
This HowTo gives an introductory overview of the partition Operators: Skip, Take, SkipWhile, TakeWhile
Introduction
The partition operators are used to fetch a particular subset from a set of items. The returned subset is formed by the contiguous items that are matching the provided condition.
Skip / Take Operator
The Skip Operator will omit the subsequent items from the given start for a given length and will return the remaining items
The Take Operator will return the subsequent items fr…
Nitya1
(Nitya Tomar)
April 15, 2023, 4:57pm
4
Hi @vinjam_likitha
Can you try this.
Split the items
string into an array using the comma (,
) separator:
itemsArray = items.Split(","c)
Calculate the total number of sets required:
setsCount = Math.Ceiling(itemsArray.Length / 50)
Use a For Each activity to loop through each set of items:
Set the TypeArgument property of the For Each activity to String
Set the Values property of the For Each activity to the following expression:
Enumerable.Range(0, setsCount).ToArray()
Inside the loop, use a Assign
activity to get the current set of items:
Use a Type Into
activity to enter the current set of items in the text box in the application.
Inside the loop, use a Click
activity to download the report.
Inside the loop, use a Delay
activity to wait for the report to download.
Inside the loop, repeat for the next set of items.
I hope it helps you.
1 Like
In For each loop in assign activity what should i add?
Nitya1
(Nitya Tomar)
April 15, 2023, 5:54pm
6
Firstly , Set the To property to a new variable named “currentSet” of type array of string and then
Set the Value property to the expression “itemsArray.Skip(index * 50).Take(50).ToArray()”, where “index” is the loop variable of the For Each activity.