Search rows in a webtable for text, then output the value

Hi,

I’m hoping someone can help me. I have a WebTable in a SAP application that I am trying to search through to find a specific text value, once found, to output the value of every cell on the row the text was found in.

For instance, I have a table with 4 columns and many rows, one or more of the columns contain the text I want, I need the script to loop through each row until it finds the text I am looking for, then output the text value in each cell on that row. The loop would end once it find a row with no data.


Any help would be much appreciated.

Thanks in advance,
Sean
Parents
  • Try this

    Dim accountnumber
    RowNum=0

    For RowNum=1 to DataTable.GetRowCount
    accountnumber = DataTable("GetAcctNumber", dtLocalSheet)

    Browser("Interaction Center - [Identify").Page("Interaction Center - [Identify").Frame("WorkAreaFrame1").WebEdit("C4_W22_V23_buagsearch_struct.z").Set DataTable("GetAcctNumber", dtLocalSheet)
    Browser("Interaction Center - [Identify").Page("Interaction Center - [Identify").Frame("WorkAreaFrame1").Link("Search").Click
    Browser("Interaction Center - [Identify").Page("Interaction Center - [Identify").Frame("WorkAreaFrame1").Link("Account History").Click
    Browser("Interaction Center - [Identify").Page("Interaction Center - [Account").Frame("WorkAreaFrame1").WebElement("WebTable").Click
    Browser("Interaction Center - [Identify").Page("Interaction Center - [Account").Frame("WorkAreaFrame1").WebElement("Sort Descending").Click

    RCount = Browser("Interaction Center - [Identify").Page("Interaction Center - [Account_4").Frame("WorkAreaFrame1").WebTable("Amount").RowCount

    For r = 1 to RCount
    DataTable.SetCurrentRow(RowNum r)
    Info1 = Browser("Interaction Center - [Identify").Page("Interaction Center - [Account_4").Frame("WorkAreaFrame1").WebTable("Amount").GetCellData(r, 1)
    Info2 = Browser("Interaction Center - [Identify").Page("Interaction Center - [Account_4").Frame("WorkAreaFrame1").WebTable("Amount").GetCellData(r, 2)
    Info3 = Browser("Interaction Center - [Identify").Page("Interaction Center - [Account_4").Frame("WorkAreaFrame1").WebTable("Amount").GetCellData(r, 3)
    Info4 = Browser("Interaction Center - [Identify").Page("Interaction Center - [Account_4").Frame("WorkAreaFrame1").WebTable("Amount").GetCellData(r, 4)
    DataTable("Account", "payment_scrub") = accountnumber
    DataTable("Payment_Amount", "payment_scrub") = info1
    DataTable("Posting_Date", "payment_scrub") = info2
    DataTable("Currency_Type", "payment_scrub") = info3
    DataTable("Description", "payment_scrub") = info4
    Next
    RowNum=RowNum RCount

    Browser("Interaction Center - [Identify").Page("Interaction Center - [Identify").Frame("FRAME_CONTEXTAREA").Link("End Contact").Click
    Browser("PDS Broker").Page("PDS Broker").Sync
    Next
    ExitRun
Reply
  • Try this

    Dim accountnumber
    RowNum=0

    For RowNum=1 to DataTable.GetRowCount
    accountnumber = DataTable("GetAcctNumber", dtLocalSheet)

    Browser("Interaction Center - [Identify").Page("Interaction Center - [Identify").Frame("WorkAreaFrame1").WebEdit("C4_W22_V23_buagsearch_struct.z").Set DataTable("GetAcctNumber", dtLocalSheet)
    Browser("Interaction Center - [Identify").Page("Interaction Center - [Identify").Frame("WorkAreaFrame1").Link("Search").Click
    Browser("Interaction Center - [Identify").Page("Interaction Center - [Identify").Frame("WorkAreaFrame1").Link("Account History").Click
    Browser("Interaction Center - [Identify").Page("Interaction Center - [Account").Frame("WorkAreaFrame1").WebElement("WebTable").Click
    Browser("Interaction Center - [Identify").Page("Interaction Center - [Account").Frame("WorkAreaFrame1").WebElement("Sort Descending").Click

    RCount = Browser("Interaction Center - [Identify").Page("Interaction Center - [Account_4").Frame("WorkAreaFrame1").WebTable("Amount").RowCount

    For r = 1 to RCount
    DataTable.SetCurrentRow(RowNum r)
    Info1 = Browser("Interaction Center - [Identify").Page("Interaction Center - [Account_4").Frame("WorkAreaFrame1").WebTable("Amount").GetCellData(r, 1)
    Info2 = Browser("Interaction Center - [Identify").Page("Interaction Center - [Account_4").Frame("WorkAreaFrame1").WebTable("Amount").GetCellData(r, 2)
    Info3 = Browser("Interaction Center - [Identify").Page("Interaction Center - [Account_4").Frame("WorkAreaFrame1").WebTable("Amount").GetCellData(r, 3)
    Info4 = Browser("Interaction Center - [Identify").Page("Interaction Center - [Account_4").Frame("WorkAreaFrame1").WebTable("Amount").GetCellData(r, 4)
    DataTable("Account", "payment_scrub") = accountnumber
    DataTable("Payment_Amount", "payment_scrub") = info1
    DataTable("Posting_Date", "payment_scrub") = info2
    DataTable("Currency_Type", "payment_scrub") = info3
    DataTable("Description", "payment_scrub") = info4
    Next
    RowNum=RowNum RCount

    Browser("Interaction Center - [Identify").Page("Interaction Center - [Identify").Frame("FRAME_CONTEXTAREA").Link("End Contact").Click
    Browser("PDS Broker").Page("PDS Broker").Sync
    Next
    ExitRun
Children
No Data