Results 1 to 5 of 5

Thread: Get the difference of global data sheet

  1. #1
    Junior Member
    Join Date
    Mar 2008
    Answers
    8

    Get the difference of global data sheet

    hi there..
    i have imported some data to globalsheet..
    now i want to subtract the data A1-A2(the data is in numbers)and see A3=A1-A2 or not..
    please help me in this regard..

    thanks
    chandu


  2. #2
    Contributing Member
    Join Date
    Feb 2008
    Answers
    36

    Re: Get the difference of global data sheet

    Hi Chandu,

    Lets assume there are three columns in your global sheet
    A1:- the first number.
    A2:-the second number
    A3:- the correct result which you know is correct.

    try the code below:
    'import the data from data table

    dtA1 = DataTable.Value("A1",dtGlobalSheet)
    dtA2 = DataTable.Value("A2",dtGlobalSheet)
    dtA3 = DataTable.Value("A3",dtGlobalSheet)
    var_sub = dtA1 - dtA2

    var_data= CDbl(dtA3)
    var_data1= CDbl(var_sub)
    If var_data1 = var_data Then
    Reporter.ReportEvent micPass, "The result is correct", "The result is correct"
    Else
    Reporter.ReportEvent micFail, "The result is incorrect", "The result is incorrect"
    End If
    --------------------

    Let me now incase u have doubts in this.

    Regards,
    Tina Mahajan.

    Last edited by Tina Mahajan; 04-04-2008 at 04:27 AM.

  3. #3
    Expert Member
    Join Date
    Jan 2007
    Answers
    211

    Re: Get the difference of global data sheet

    Global Sheet has an Issue i.e the number of entries implies that number of Run.

    If the Data is in the Local Sheet then its pretty much simple. You need a loop for the entries..

    DataTable.SetCurrentRow(1)
    While Datatable.Value("A1",dtglobalsheet) <> ""

    Datatable.Value("A3",dtglobalsheet) = Datatable.Value("A1",dtglobalsheet) - Datatable.Value("A2",dtglobalsheet)
    DataTable.SetNextRow

    Wend


    Regards,
    Nawab


  4. #4
    Moderator
    Join Date
    Sep 2006
    Answers
    920

    Re: Get the difference of global data sheet

    Quote Originally Posted by NawabShaikh View Post
    Global Sheet has an Issue i.e the number of entries implies that number of Run.

    If the Data is in the Local Sheet then its pretty much simple. You need a loop for the entries..

    DataTable.SetCurrentRow(1)
    While Datatable.Value("A1",dtglobalsheet) <> ""

    Datatable.Value("A3",dtglobalsheet) = Datatable.Value("A1",dtglobalsheet) - Datatable.Value("A2",dtglobalsheet)
    DataTable.SetNextRow

    Wend


    Regards,
    Nawab
    Hi, I think this is the case with local sheet also. Am i wrong? Because i feel it when running my script.

    Regards,
    Brijesh Jain
    ---------------------------------------------------------
    Connect with me on Skype: jainbrijesh
    Google Plus : jainbrijeshji

  5. #5
    Expert Member
    Join Date
    Jan 2007
    Answers
    211

    Re: Get the difference of global data sheet

    I would not confront on the issue, but we had a comfort-level while using LocalSheet on Test Scenario....I will revert with a sourceCode/video file if possible...similar contribution expected by other members


    Regards,
    Nawab


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact