Click through multiple rows on a webpage in Blue Prism - blueprism

I have run into an issue trying to retrieve data from a table on the surface of a web page. In each row of the table there is a link that leads to more details about the information in each row. See image The automation needs to decide whether or not to copy the row information based on criteria that is only given within the link.
Part of where I'm stuck is due to the fact that the number of rows in the table can vary, so I can't just specify each link as it's own element. So I need my bot to:
Start at the first row of information
Click the details link
Decide whether or not the information from the correlating row is needed
Go back to the place where the table is and copy down info if needed
Go to the next row and repeat steps 1-4 for the rest of the table
I believe I have a handle on step 3 and 4, along with 2 if clicking an element doesn't change with iterating through the table.
Thanks!

Just create a loop, that will iterate it self every time whenever you will go back to the table after copy info from the row.
So I would do something like that:
1.Click the details link
2.Decide whether or not the information from the correlating row is needed
3.Go back to the place where the table is and copy down info if needed
4.Go to the next row and repeat steps 1-4 for the rest of the table
5.Check if there is a next row. Yes? Loop to step 1. No? End.

Related

Power Automate - Update last row in an Excel table

I currently use an Excel spreadsheet to store all users 4 digit printer code. This 4 digit code is incremental so when a new user joins our team, their code will be 1 digit higher than the previous user who joined, e.g. previous user code 1122, new user code 1123.
printer codes sheet
What I'm trying to do is:
Submit a form via MS forms with the basic details of the new user. The flow then adds the information from the form and adds it to the printer code excel sheet.
The flow will grab the printer code of the previous user above and raise the value by 1 and assign it to the new user added.
For the most part this process is working as intended. Where is it failing is the flow isn't grabbing the code from the previous user, but the code 250 rows earlier.
Please see my flow below:
Getting form details and listing rows in table
I then use 2 compose actions to grab the last row in the table and then update the value by 1:
grab last row
add + 1
The information from the form is then added to the spreadsheet table, using output 2 as the content for the Code column.
Add row
From what I can gather the problem is my first compose formula, as the incremental compose is adding +1, but not to the row above.
compose input/output
compose 2 input/output
The code the flow grabbed was 1388 as it will add the code 1389. But the last user added is 1641 so the new user should have a code of 1642.
If anyone knows what I am doing wrong and could share it would be greatly appreciated.
Thank you.
You can try this to get the row with the highest value in column “Code”:

Use userform to search for unique identifier and update

I have information entered into a spreadsheet using a user form, each row has a unique user id and a bunch of data and pre-labeled empty columns for future updated information.
I have created another user form that I want to use to update empty columns in the rows as required. I want to be able to enter the unique id into a text box and updated information to populate blank columns into other relevant text boxes and when I hit edit it searches for the relevant unique id and puts the information into the relevant columns of that row.
I do have the clear and close buttons working.
update form.
This is my sample spreadsheet, with empty columns to be populated when updating
sample spreadsheet
And the information currently entered into the spreadsheet is entered by this user form.
enter information
I had previously found something like this on this site, but now cannot find it.
I am super new to this and would not know where to start to create my own cod
Add here the excel sheet sample to see the table structure. The userform for updating records is in the same sheet as the data?

QTP row and column count is always 1

I am writing a piece of code to copy data from a web table to an excel sheet. I don't understand why I am getting row count and column count 1. Is there something else that I need to add?
Here is my code:
Dim XL
Set XL=createobject("Excel.Application")
XL.Workbooks.Open "D:\QTP\RailwaysforSurat.xlsx"
Set nsheet = XL.Sheets.Item(1)
row=Browser("title:=.*").Page("title:=.*").WebTable("html tag:=TABLE", "index:=0").GetROProperty("rows")
msgbox row
cols=Browser("title:=.*").Page("title:=.*").WebTable("html tag:=TABLE", "index:=1").GetROProperty("cols")
msgbox cols
This not complete code. I have trouble getting rows and columns count. Please help!
P.S. I am using this website for the testing "http://www.indianrail.gov.in/cgi_bin/inet_trnnum_cgi.cgi"
I noticed that you are using Descriptive Programming techniques to identify the WebTable, but you're using extremely generic descriptions for everything. Perhaps that's just scrubbed for the sake of posting publicly, but the important thing that I notice is that your code to read Rows is trying to find a table with Index of 0 and your code to read Cols is trying to find a table with index of 1...
This means you are accessing two different tables. Are you sure that your descriptions are finding the table that you think you want?
My suggestion is to:
1) bring up the page in your browser so that you can see the table.
2) Bring up QTP and open the GuiSPY
3) Click the pointing hand over a cube button to begin spying
4) Click on something inside the table you are trying to work with.
GuiSPY will snap back and show a hierarchy of objects that it found. Next, you want to positively identify what level in that hierarchy is the table at... I would...
5) starting at the top (Browser), select the top row and click "Highlight in Application" and watch what gets lit up.
6) go down the hierarchy list clicking the next item in the hierarchy and clicking "Highlight in Application" until you see it flash on the exact table you're trying to target.
7) Once you have isolated the table, click the button for "Copy the identification properties to the clipboard" button, then close GuiSPY.
8) Open a notepad, or just use QTP's editor window itself and paste in what GuiSPY copied to clipboard.
Ok, you now have a complete list of everything QTP was able to see about the specific table you want to detect. From here, you want to look through the list of properties and find one (or two) that would positively identify that table every time.. For example, on this very page, the table that holds your question could be identified as:
WebTable("text:=I am writing a piece of code to copy data")... (*note I've shaved it down because it's automatically a Regex string... With some cleanup, it could be:
Browser("StackOverFlow.Com").Page("Question 36663629").WebTable("text:=I am writing a piece of code to copy data"))
Now replace your .WebTable("html tag:=TABLE", "index:=0") with that data you've selected, and try it again. Hopefully you can lock in on the exact table you're expecting and get the info you need.
The indianrail page did not open so cannot see the table you are testing. But QTP provides default methods for rows and columns, try using that and see if it works.
NumRows = Browser("Mercury Tours").Page("Search Results").WebTable("OutboundFlights").RowCount
NumColumns = Browser("Mercury Tours").Page("Search Results").WebTable("OutboundFlights").ColumnCount(1)
ColumnCount takes row number as parameter
Not sure what tables you are looking at, but if it is Services and information then the rows/cols value for those table is 1.The whole web page is consisted of concatenated web tables. So its going to be little tricky to capture that information. Try using a child object method and count the number of links within the web table, its going to look something like this -
Set oWebEdit=Description.Create
oWebLink("micclass").value="Link"
Set olink = Browser("title:=.*").Page("title:=.*").WebTable("").childobjects(oWebLink)
olink.count
msgbox olink.count
'Then initiate a for loop
For i = 0 to olink.count-1
' Get the link name
olink. count(i).GetRoproperty("name")
'Initiate an array and save the link names
If get link name does not work then you can use childitem method.
Also make sure you are using the correct index for the tables or define some other properties as well.
P.S. If you are going to use DP in future and haven't already then read about Childitems/childobjects methods.They come in real handy while using DP.

Data entry user form, copy paste with variation data

I'm working on a user form in excel vba. The purpose of the user form is to make data entry more efficient. The data that is being entered is for shoe products. Basically a "parent" of the data is made in one row. The proceeding rows, or what I refer to as children/variations, have the exact same data except certain fields(columns) will be variations of the parent and each variation will have a unique identifier.
For example: say we're entering data for "shoe123". The parent data would be like this
Title Sku
Shoe123 S123
Then the children would be in the row underneath with the same data except the variation size will be tagged at the end of some fields as well as a unique identifier for each variation. Theyd look something like this.
Title Sku
Shoe123 10.5 s123 10.5
Shoe123 11 s123 11
Uniqueid
09876543311
09876543321
So at this point I have been able to enter all the parent data in the form and transfer it to the appropriate column. I'm trying to figure out two things.
How can I code the user form to allow the user to enter the number of variations to create? and then based on the number the user enters, populate that number of combo boxes with pre filled size selections with text boxes next to each combo box to enter the unique identifier?
How would I copy and paste all the parent data with the variation data for each size selected as well as the unique identifier for each variation?
so far I'm thinking I'll need to use arrays for the copy and paste part. I just need some direction. Any help is greatly appreciated!
Thanks Everyone
I understand from your question that you are trying to create a database. If this is correct I would advice you to try and create this in Access. In Access it is a lot easier to link parent data to children. It will also safe you all the time you would need in Excel to code the userforms, etc. as this is (almost) use-ready provided in Access.
If you are determined to create this in Excel, perhaps you could show the vba-code you have so far?

Filling rows of a repeating table on opening the form

In my Infopath form I use a repeating table. On opening this form on sharepoint I would like to have some rows of the repeating table filled out using information from an other list. I use content types.
What i am working on is a Timesheet system where the user can register how many hours a week he worked on different projects.
I would like that by creation of a timesheet some predefined projects will be already inserted, meaning that the repeating table will have for example 5 rows already with 5 favourite or most used projects selected based on a separate PetProject list.
When I looked at the workflow in the list where the timesheet is being created I couldn’t find the column projectname in the dropdown so I cant give it a value. When I went to look in the Form settings of TimeSheets I saw that projectname cant be selected/edited, its in plain black whereas the other columns are blue and clickable. I thought its probably because the value of projectname is merged from the different rows in the repeating table.
Is there any way I can work around this problem and assign a value to projectname by creation of the timesheet?
Thank you so much!
I think that you will need to write some code to query the data that you are after and add the data to new rows in the repeating table.
There is a loading event that you can hook into to then query a secondary data source and then
add the row to the repeating table.
Will this run with in infopath as a thick client or will it run as a browser based form using infopath form service?

Resources