cancel
Showing results for 
Search instead for 
Did you mean: 

Finding latest document in web based application

SwatiAgrawal
Level 5
Hi,
I have launched a web based application. Now after inputting certain values in the required fields, I will click on search. The search result will give me a list of documents wherein the date beside every document is also mentioned. Now I want to click the latest document, open it and save it.
For Eg: - The search result shows below table. These values are not constant. It may be possible that I get zero results or it may be possible that I get to see only 1 result. It may vary everytime I search. Each entry here is clickable and a pdf document opens when clicked.
21547.pngHowever, after I click on Search, I want to look for the following -
1. Latest "Salary Proof" document, click it, open it and save it at a certain location.
2. Look for all "Address" documents that lies between certain dates Eg: 1/5/2021 to 31/1/2022. Click on those documents and save to a particular location

Can you help me how can this be achieved ? 

Thanks in advance !!

------------------------------
Swati Agrawal
------------------------------
1 BEST ANSWER

Helpful Answers

Hi Swati,

In filter query, wildcards do not work like that. In the previous post since you showed us that you are only going to have the value as Address, that is why I posted that Query. In case you want to use a wild card match, then you can use the below query: "[Doc Name] LIKE '%Address%'

Now when you are setting the filtered result in a collection, I would suggest to set the output to a predefined collection where you set up columns, one as Address and one as Date which are exactly similar to the headers of the collection that you are trying to filter. Only keep in mind that the Date column should be set to 'Date' type as it will be important for the next step.

In the next step, use 'Sort Collection' action on the 'Date' field in Descending order. Then you can use 'Read Collection Value' action as many times as the columns available while passing the row index as 0 so as to retrieve the corresponding row values which you can then pass dynamically in any 'Navigate' stage to click on the link having that particular name, date and SL. No. which you grabbed earlier.


------------------------------
----------------------------------
Hope it helps you and if it resolves you query please mark it as the best answer so that others having the same problem can track the answer easily

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
Wonderbotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.

View answer in original post

11 REPLIES 11

PabloSarabia
Level 11
Hi!

Here you have a quick procedures to make this:

For the latest:

21429.png
- You have a collection with all the documents and dates (Two collumns, Document and Date).
- Need to initialize the date variable. I set it to 01/01/1900
- Then, you make a loop iterating the collection row by row.
- With a simple choice you decide if the new data of the row is greater than the date that you have storage in the "Last Date" data item. 
21430.png- If is older, you save the document's name and date. (Take care, case if you have two documents with the same date, you only save the first, is greater than > , no greater or equal than >=)



For the second problem, 
21431.png
Similar to the first solution. Now i save the information in a collection, so if you have more than one document, you save all.

- Create two new data items and store on it the maximun date and the minimum date.
- Then, change the Choice decission to this: [Documents.Date] >= [Min Date] OR [Documents.Date] <= [Max Date]



Hope this helps you 

Bye 🙂



------------------------------
Pablo Sarabia
Programmer
Altamira AM
------------------------------

Hi Swati,

Considering you want to perform this operation altogether on a single website, the way you can go around is to first see if you are able to capture the entire web table into a collection or not. If you get the collection populated then, I would suggest you to use the 'Filter Collection' action and use the filter query like: "[Doc Name] = 'Salary Proof'", this will give you the collection with all the rows having the documents named 'Salary Proof'.

Now you can loop within the collection and then try to click on the PDF document link having a dynamic attribute which you can pass to be the Sl.No if Sl.No us clickable otherwise you can write an XPath expression which can click on the subsequent link to that Sl. No selected which is currently in the loop. The XPath expression will totally depend on your web schema so I can't give you an exact word for it.

Post this you can do the related UI interaction to save it in some folder which you can take via a environment variable.

Similarly for other document, grab the entire table and then use 'Filter Collection' action with filter query like: "[Doc Name] = 'Address' AND [Date] > '#" & [Start Date] & "' AND [Date] < '#" & [End Date] & "'"

Note: [Start Date] and [End Date] will consist of the range which you need to compare to.

Then repeat the same steps to get the required Sl. No and click on the adjacent link to download the document the same way.

You can also include the logic at the very beginning that if you don't get any table out of it throw a business exception.



------------------------------
----------------------------------
Hope it helps you and if it resolves you query please mark it as the best answer so that others having the same problem can track the answer easily

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
Wonderbotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.

Thanks Pablo & Devneet for your help.

However I am stuck at the first point itself. The entire web table cant be read into a collection. I tried reading it but it gives me no output. The collection remains blank.
The rows also don't get identified in the web table. So now I am reading each and every cell. 
Eg: In below table, I am reading each cell with value of this type - Address of ABC 24/5/2020. This cell also has date mentioned at the end. So I dont need to read other column cells for date purpose.
21434.pngHowever, when I get current value of each cell then it gets stored as a data item. Now, I am not sure how to make a collection of all these cells after getting current value for each cell. Because, finally, I need to open and save the latest document.

Thanks in advance !!






------------------------------
Swati Agrawal
------------------------------

Hi,

Here you have two optional ways that can helps you

First one! Did you try to spy with the Application Modeller the full table and then, with the Read Stage use the "Get Table" Option? 

Application Modeller;
21436.png

Reader Stage:
21437.png


Second way... I remember one integrationt that we need to read all links from a similar table, but the "Get Tables" didn't works 😞 Here we use the Dynamic expression for the Path attribute in the application modeller. 

If you make this, you will need to make a loop to get all the information. You can also put the calculation to see if is the older document against save all in a collection and then iterating the collection...

One tip for the Dynamic option.... Spy the first and the second links, compare her path attributes to see what change. To use it... in the read stage you need to pass a param. Here you need to write the full path, so you may need to storage in another data item the variable part

21438.png

Hope this finally helps you. Remember mark the answer as the best if this solve the problem 🙂


Bye 🙂

------------------------------
Pablo Sarabia
Architect
Altamira Assets Management
Madrid
634726270
------------------------------

Hi Swati,

I would suggest you to try couple of things to check this. First try to see if you are able to change the Element type of your spied element to 'Web Table' type or not.

21441.png

If you are got getting the element, then try to see if you are able to view the table element in the Application Modeller for that given element using the Application Navigator which can be access from the arrow besides Identify button:

21442.png

21443.png

If you are getting one then you can use the Read Stage and select the action 'Get Table Items' and you should be able to get the table data into a collection.

21444.png

If the above approach doesn't work then try to spy any of the table element and using dynamic counters, you can traverse the entire table in your workflow.

Here you see I have made the attribute dynamic in the modeller:

21445.png

And now I can manipulate the path in my workflow by using some incrementing logic with TD and TR counters:

21446.png

This logic of determining these counter values will depend on the nature of your web table like if there are any pagination involved or if there are footers and headers something like that. Also, remember to incorporate exception handling properly so that in case you do not get any search result as you might have crossed the counter limits, then the bot should gracefully exit the flow.

Once you grab the cells of all the fields for a particular row, add a new row to the output collection which you can define from the beginning with all pre-defined fields and then set up the values in the output collection using Calculation or Multi Calculation stage.

------------------------------
----------------------------------
Hope it helps you and if it resolves you query please mark it as the best answer so that others having the same problem can track the answer easily

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
Wonderbotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.

Thanks Pablo & Devneet,
The second way out in both of yours solution worked for me. So, I had to iterate through table by putting dynamic values in "match index" box in Application Modeller. This way I am able to get entire table as collection. 
But now my next stucking point is as below which I will explain through an example.
I am creating collection for below table. In the collection , I am only keeping one column (the first one since it has dates also mentioned).
21450.png

From this table, I need the following -
1. Open and save the latest address document. Now, @devneetmohanty07, I was using filter option that you suggested. But since the names have only "Address" common in the beginning, so I am using Filter collection [Document Name] = "Address*" but this doesnt work. Also, I am wondering how will the bot know after filtering that which is the latest document ?
2. Once point 1 works , I believe the opening and saving of documents which are between certain periods will also work.

Thanks in advance !!​

------------------------------
Swati Agrawal
------------------------------

Hi Swati,

In filter query, wildcards do not work like that. In the previous post since you showed us that you are only going to have the value as Address, that is why I posted that Query. In case you want to use a wild card match, then you can use the below query: "[Doc Name] LIKE '%Address%'

Now when you are setting the filtered result in a collection, I would suggest to set the output to a predefined collection where you set up columns, one as Address and one as Date which are exactly similar to the headers of the collection that you are trying to filter. Only keep in mind that the Date column should be set to 'Date' type as it will be important for the next step.

In the next step, use 'Sort Collection' action on the 'Date' field in Descending order. Then you can use 'Read Collection Value' action as many times as the columns available while passing the row index as 0 so as to retrieve the corresponding row values which you can then pass dynamically in any 'Navigate' stage to click on the link having that particular name, date and SL. No. which you grabbed earlier.


------------------------------
----------------------------------
Hope it helps you and if it resolves you query please mark it as the best answer so that others having the same problem can track the answer easily

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
Wonderbotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.

Hi!

Yeaah, that is! This filter works really similar to the WHERE statement in SQL



Bye 🙂



------------------------------
Pablo Sarabia
Architect
Altamira Assets Management
Madrid
634726270
------------------------------

Hi Devneet,

I was using the ways that you mentioned but I am not able to get the filtered collection. Pls see below -
This is my input collection that has all values from which I want to filter.
21495.png
Then I am using Utility - Filter Collection. I have already created output collection with pre defined fields similar to my input collection.

This is my output collection -

21496.png
These are values I am giving in Utility Collection - Filter Collection

21497.png
21498.png

When I am running this flow, its giving me an empty output collection.
21499.png
Not sure, where I am going wrong ?
Can you help pls.

Thanks in advance !!


------------------------------
Swati Agrawal
------------------------------