Getting values from a second page of a table that is linked to by javascript

28 posts in this topic

Seminko 1

so here's what's going on. I'm working on an Overtime calculator for my company's attendance system.

When you calculate all the values, you have to add overtime values from the month before which are stored in the following table:

I am able to access this data and grab what's necessary from both of the tabs in the table.

However

The brilliant coders thought it would be a good idea to only display 12 rows of values and put the rest to another page (as you can see at the bottom there is [1] and [2]. I can get the data from the second page of the table but only if I manually click it. Which, as you can imagine, would ruin the whole point of this tool.

Is there a way to somehow get the data from the second page of the table without manually clicking on it? Unfortunately, the link is the same link as the page itself so there is some javascript happening when clicked.

Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

$oIE=_IEAttach("xyz","URL")$oTable=_IETableGetCollection($oIE); Gets the tables$iNumTables=@extended; Gets the table IDs; and then itterate through all of them to find the ones I need#cs
*************** THIS IS TO CHECK FOR THE TABLE NUMBER *********************
MsgBox(0, "Table Info", "There are " & $iNumTables & " tables on the page")
For $i = 1 To $iNumTables+1
$oTable = _IETableGetCollection ($oIE, $i)
$aTableData = _IETableWriteToArray ($oTable)
_ArrayDisplay($aTableData)
Next
*************** THIS IS TO CHECK FOR THE TABLE NUMBER *********************
#ce; Once I have the correct table IDs I do:$oTable=_IETableGetCollection($oIE,26); and then create an array from them:$aTableData=_IETableWriteToArray($oTable)

Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

IENavigate doesn't work either, as I mentioned above. It just tries to load "http://aspxgvpageronclick('ctl00_contentplaceholder1_aspxroundpanel1_pcprehled_aspxcpprescasy_aspxcpprescasygrid_gv1','pn1');/"

Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post

Link to post

Share on other sites

Seminko 1

$oTablePagesSaldo=_IETableGetCollection($oIE,$TableForDruhaStrankaSaldaID); $TableForDruhaStrankaSaldaID is the table which shows the number of pages$oTableDataPagesSaldo=_IETableWriteToArray($oTablePagesSaldo)IfStringInStr($oTableDataPagesSaldo[0][0],"Page")>0Then; Checks if the first part of the array says "Page", if it doesn't there is only one page and we do not need to click anything.$oTableDataPagesSaldoPosledniStrankaHledejOF=StringInStr($oTableDataPagesSaldo[0][0],"of"); Page 1 of 2 (14 items) / Looks for the position of "of"$oTableDataPagesSaldoPosledniStrankaHledejZavorku=StringInStr($oTableDataPagesSaldo[0][0]," ("); Looks for the position of "("$oTableDataPagesSaldoPosledniStrankaData=StringMid($oTableDataPagesSaldo[0][0],$oTableDataPagesSaldoPosledniStrankaHledejOF+3,$oTableDataPagesSaldoPosledniStrankaHledejZavorku-$oTableDataPagesSaldoPosledniStrankaHledejOF-3); returns the number of highest number of the pages;MsgBox(1, "", $oTableDataPagesSaldoPosledniStrankaData);_ArrayDisplay($oTableDataPagesSaldo)Local$sMyOnClickString="aspxGVPagerOnClick('ctl00_ContentPlaceHolder1_ASPxRoundPanel1_PCPrehled_ASPxCPPrescasy_ASPxCPPrescasyGrid_GV1','PN1');"; here I will replace the 'PN1' with sth like 'PN' & $oTableDataPagesSaldoPosledniStrankaData - 1Local$oTD=_IE_Table_GetTD($oTablePagesSaldo,$sMyOnClickString)$oTD.Click()EndIf

EDIT: however, is there a way for the script to wait until the page is fully loaded after " $oTD.Click() " ?

Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."