Range between numbers

kiss4344

Member
Can someone help to achieve this using BluePrism?

Find the range between the below numbers and convert numbers into text and store it in a single variable in descending order

63536-63540
83728-83728
84823-84824


Output – { 84824, 84823, 83728, 63540, 63539, 64538, 64537,64536}
 

sivagelli

Well-Known Member
Unfortunately, i cannot share images due to restrictions. However, here is the solution.

I assumed you have the below numbers as text datatype in a collection. Lets call it InitialCollection and have this on Main page.
63536-63540
83728-83728
84823-84824


Create a Page and Name it "Collection - Get in Descending Order". Inputs to the page are the data row from InitialCollection.

Design Page, Collection - Get in Descending Order with following flow-

1. Start (accepting the text format number)
2. Split (VBO- Utility Strings; Action: Split Text). This will output a collection with numbers split in to two rows. Lets call it SplitCollection
3. Start Loop
  • Get first number and second number in to two data items. While writing in to data items cast them to numbers. Lets call them FirstRow and LastRow
4. End Loop
5. Get difference between the two numbers
6. Based on Difference you have to modify the SplitCollection
  • If difference is 0 (in case of second row, 83728-83728)
    • Then remove a row. This will result in Collection to have only 83728
  • Else if difference is 1 (in case of third row, 84823-84824)
    • Then do nothing
  • Else if difference is more than 2 (in case of 63536-63540)
    • Then add row to the SplitCollection -> Increment value of the FirstRow and store in SplitCollection
    • Check again for difference and go to above point till difference becomes 1
7. Page has to send SplitCollection Collection as output to Main page

Main Page
1. Loop thru the rows of InitialCollection calling the page, Collection - Get in Descending Order
2. Append the output collection received from page, in to another Collection. Lets call this FinalCollection
(Once the loop ends you will have FinalCollection with all the values.)
3. Sort collection, FinalCollection. Use VBO - Collection Manipulation; action: Sort Collection
By this time, you will be very close to your solution with FinalCollection having data- 84824, 84823, 83728, 63540, 63539, 64538, 64537,64536.
4. To get the desired output: {84824, 84823, 83728, 63540, 63539, 64538, 64537,64536}
5. Loop thru the FinalCollection and build the structure


I hope this gives enough direction to solve the problem statement.

Let me know how it went!
 
Top