SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 9 of 9
  1. #1
    Member
    Join Date
    Jun 2008
    Posts
    133
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Getting cell data from Dynamically changed columns & rows in QTP

    Hi All,

    I 've a webtable in my application where in I need to get the data from all the cells in the web table. Below is the code which I 've written. I 've attached the webtable structure how it looks like in my application. Please refer to the attachement.

    Now the problem is I 've column headers in the webtable ("SV",CV,Margin%). On top of it I 've 3 more headers ( "PO's Raised TW", "POs To Be Raised TW","Total New Commitment TW")

    How Can I differentiate SV, CV, nd Margin % to the headers present on top of it. Suppose i want to check the value for SV which is present in "POs To Be Raised TW" for the "Home shop section". How can I do this.

    All these columns and rows position are dynamic. You can have more rows and columns in future .How to write a code to get all the data present in the webtable w.r.to the columns present at the topmost( "PO's Raised TW", "POs To Be Raised TW","Total New Commitment TW")


    'Getting the row header
    x=Browser("SAS Information Delivery").Page("SAS Information Delivery").Frame("Frame").WebTable("POs Raised TW").GetROProperty ("rows")

    For i=1 to x

    section =Browser("SAS Information Delivery").Page("SAS Information Delivery").Frame("Frame").WebTable("POs Raised TW").GetCellData(i,1)

    If section="HOME ACCS" Then

    irow=i
    msgbox irow

    End If

    Next

    'For getting the column
    y=Browser("SAS Information Delivery").Page("SAS Information Delivery").Frame("Frame").WebTable("POs Raised TW").GetROProperty ("cols")

    For j= 1 to y

    section =Browser("SAS Information Delivery").Page("SAS Information Delivery").Frame("Frame").WebTable("POs Raised TW").GetCellData(1,j)

    If section="POs Raised TW" Then

    icol=j
    msgbox icol
    End If

    Next

    section =Browser("SAS Information Delivery").Page("SAS Information Delivery").Frame("Frame").WebTable("POs Raised TW").GetCellData(irow,icol)

    msgbox (section)


    Thank you for your replies.
    Attached Images Attached Images

  2. #2
    Member
    Join Date
    May 2010
    Posts
    66
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    Hi Vamshidhara,

    Are you able to retrieve all the cell values in the web table (shown in the attachment) by directly hardcoding the row and col no.?


    Thanks
    Swati

  3. #3
    Member
    Join Date
    Jun 2008
    Posts
    133
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    Quote Originally Posted by Swati123P View Post
    Hi Vamshidhara,

    Are you able to retrieve all the cell values in the web table (shown in the attachment) by directly hardcoding the row and col no.?


    Thanks
    Swati
    Hi Swati,

    Yes I could able to retieve all the values by hardcoding the row and column values. But in future the table might have some more additional rows and columns,so that's the reason I dont want to hard code the row ,column values.

  4. #4
    Member
    Join Date
    May 2010
    Posts
    66
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    No,Hardcoding is never recommened .What i wanted to know whether you are able to fetch the values or not. If yes, thats grt.

    Can you please note down the below details for my understanding :

    Total row count?:
    Total Column Count? :

    Row No and col No. values to fetch CV (under PO Raised TW)
    Row No and col No. values to fetch 40.1 (under PO Raised TW)
    Row No and col No. values to fetch 47.4% (under PO Raised TW)

    Row No and col No. values to fetch CV (under Total New Commitment TW)
    Row No and col No. values to fetch 40.1 (under Total New Commitment TW)
    Row No and col No. values to fetch 47.4% (under Total New Commitment TW)

    Thanks
    Swati

  5. #5
    Member
    Join Date
    May 2011
    Location
    California, US
    Posts
    306
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    To get the cell data dynamically - the method i would follow is

    1. identify a column(may be like a primary key) with whose value we identify that particular row and action on it
    2. using the Column name eg.EmpID- get the column no
    3. Using the primary key value(point 1) - try to get the row no in the ColumnNo retrieved form point2

    now that you have row and column no's - identity which column value you would like to change/read for that record
    4. Using the same login as in pt2 - get the column no. whose attribute you would like to change/read

    Regret that i didnt refer your data w.r.t columns and row names, to make it simple
    --
    Vijay

  6. #6
    Member
    Join Date
    Jun 2008
    Posts
    133
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    Quote Originally Posted by VijayChander View Post
    To get the cell data dynamically - the method i would follow is

    1. identify a column(may be like a primary key) with whose value we identify that particular row and action on it
    2. using the Column name eg.EmpID- get the column no
    3. Using the primary key value(point 1) - try to get the row no in the ColumnNo retrieved form point2

    now that you have row and column no's - identity which column value you would like to change/read for that record
    4. Using the same login as in pt2 - get the column no. whose attribute you would like to change/read

    Regret that i didnt refer your data w.r.t columns and row names, to make it simple

    Hi Vijay,

    Thank you for your reply.

    Even I 've used the same logic which you have posted . But the problem is in my webtable the column names are same.(SV,CV,Margin) only way we can differentiate is by looking at the top most column ( Po's raised,Po's to be raised, nd total commitment). By these as my columns how can I differentiate SV,CV and margin.there is no problem in getting the rows (HOMESHOP,HOME ACCS,HOME TEXTILES).

    hope I 'm clear my question.

  7. #7
    Member
    Join Date
    May 2011
    Location
    California, US
    Posts
    306
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    Quote Originally Posted by vamshidhara View Post
    Hi Vijay,

    Thank you for your reply.

    Even I 've used the same logic which you have posted . But the problem is in my webtable the column names are same.(SV,CV,Margin) only way we can differentiate is by looking at the top most column ( Po's raised,Po's to be raised, nd total commitment). By these as my columns how can I differentiate SV,CV and margin.there is no problem in getting the rows (HOMESHOP,HOME ACCS,HOME TEXTILES).

    hope I 'm clear my question.
    Sorry Vamshi, didnt go through the entire detail, will get back with my thoughts at the earliest
    Last edited by VijayChander; 01-16-2014 at 05:56 AM.
    --
    Vijay

  8. #8
    Advanced Member venu.adhikesevan's Avatar
    Join Date
    Jun 2010
    Posts
    517
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0
    included few steps check and revert
    Code:
    Prevcolumn = 0
    For j= 2 to y
    
    section =Browser("SAS Information Delivery").Page("SAS Information Delivery").Frame("Frame").WebTable("POs Raised TW").GetCellData(1,j)
    
    If section="POs Raised TW" Then
    
    For x = Prevcolumn + j to y
    subsection = Browser("SAS Information Delivery").Page("SAS Information Delivery").Frame("Frame").WebTable("POs Raised TW").GetCellData(2,x)
    
    If subsection="CV" Then
    icol=x
    msgbox x
    End If
    Next
    
    End If
    
    Prevcolumn = J
    
    Next
    
    section =Browser("SAS Information Delivery").Page("SAS Information Delivery").Frame("Frame").WebTable("POs Raised TW").GetCellData(irow,icol)
    
    msgbox (section)
    Venu
    Today is always better than Tomorrow
    My Blog
    My LinkedIn

  9. #9
    Member
    Join Date
    Jun 2008
    Posts
    133
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    Hi Venu,

    Thank you for the Code..this is working fine for now..

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 9.68%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 01:54 AM.

Copyright BetaSoft Inc.