Iterate Quarterly

I have a automation that will run in October and will need to download the quarterly reports for July, August and September. I have attached a screen shot. If i were to run it today it would have to pull the reports from May, June, and July. The reports are added every month so i would only have to click on the first three reports. If i were to run it today it would iterate through the first three and click the invoice number link. When it runs in October

it would need to do the same. Any ideas on the best approach?

Your explanation was not clear. If you’re stuck on deciding what cells to select, it could be solved by a very simple DateTime checking and an If activity. But I guess you’re thinking about running based on a schedule. If yes, then you must go for cron* jobs and the best cron job in our case Triggers in Orchestrator. Set a time and voila.

*cron is a time-based job scheduler. Simply put, you handle a task or a job to a cron scheduler and it executes that task in a defined fixed time or intervals.

So you want to run it and it would download the previous quarter or the last three previous months?

Either way you would need to identify what the current date is to determine which months to open

I would then recommend reviewing the selectors to determine if you can make some dynamic selectors to click. On the relevant months report link.

Thanks for reaching out, I would only have after to click on the first three invoice links and stop after the third one. The invoice dates shouldn’t matter. Just need to click on the first three invoice # links. Let me know what you all think and thank you for getting back!

Are you able to share the selector of the date first date and also the first invoice # in the table, then I can try and identify a pattern for you to use.

Another option is to use the date as an anchor and click the invoice # relative to that.

If its just the top three then you can just work out, what looks like the last day of the month into an array or list of strings then loop through each of those.

As of now i used the invoice # as an anchor and used three click activities to get the first three invoices. The reports are posted automatically once every month, so if it were October then the first three reports would be July, August, September. Does this sound like a good approach ?

As long as the automation is stable and working then it sounds like a good approach.

As long as the layout of the page doesnt change you will be good.

Using Selectors dynamically is genernally a better option but you can change your appraoch depending on what you need to do.

How should i share the selector with you ?

If you click on the selector of the date / invoice # then just paste them in here.

or save them into a text file and message them to me.

The attached pictures are from me inspecting the invoice and date columns of the web page. The third picture is the selector for the first invoice PR00190695. I used the invoice # as the anchor. Is this what your looking for?

Yes, could you also share the selector of the invoice date using uiexplorer for 7/31/2020.

It appears that the html is formatted as a data table, so you could use dynamic selectors to find the row with ur date, and use tablecol =3 for the invoice # column to click on it.

Attached are my three selectors for the click on PR00 invoice files under the invoice #.

Can you show selector for the date colum please?

I see in uiexplorer on the right hand side there is an attribute that is unselected which is table row.

As mentioned before I have a feeling you can get the selector of the date field and use that to build your selector for the invoice #

Is this it?

Is there a way to use element exists activity in the date column. I spent some time researching selectors and its starting to make a little more sense. i have a few questions you might be able to help with.
Right now I’m just using the invoice # as my anchor and using three click activities to click the first three reports in the invoice # column and not even checking the dates.

What would be a good approach if i wanted to use the date column before clicking the the report? If date = 10/01/2020 then click invoice # ? I was thinking a element exists or a find element activity? I’m having trouble understanding where i should add my created variable or to the activity that checks the date in the invoice date column. Let me know what you think i attached a picture that might help.sel.pdf (52.5 KB)

Yes so that is what I was trying to lead you to. You would have a list or array of the three dates for the past 3 months. As you can see in the HTML - you have a TR which is your row on the datatable. You then have TDs which is your cell inside that row, the second TD is your Date, and I assume the third TD is your invoice number.

So you can locate your element using a selector with your date then find the corresponding Invoice #.

Thank you for all the help i will figure this out eventually. I have attached a picture of what I’m trying to do. Could you look at it and let me know if im on the right track and give some more guidance?sel2.pdf (139.4 KB)

So the first part would be to assign the last dates of the previous three months from now to a list.

You can do this by creating a New List(Of String) - then adding the date by using the below:

(New DateTime(Now.Year,Now.Month,1)).ToString(“MM/dd/yyyy”)

You can change the Now to the date of the month you want to look for.

You can then loop through that list and then create your selector to look for:

Element Exists would work here to confirm the date is correct -

This would gie you the selector for that particular rows .

You can pass your variable directly into the selectors - you will need to fine tune your selector to make sure it works for any date provided so you might need to review the role=‘row’ line.
your last line on the selector would be

"<ctrl name ='" + Date + "' role='cell' />"

The row you will need to amend the row number of to find the correct Invoice # is:

<webctrl parentid ='masterTileTable' tableCol='3' tableRow='XXXX' tag='B' />

XXXX is the row number you retrieve from that date selector

Thank you, I will let you know how it turns out.

1 Like

Not sure if im on the write track for creating the new list of string in the assign activity. can you look this over and let me know?