SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    May 2008
    Location
    Visakhapatnam
    Posts
    33
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    XLSDriver Returns 1 instead of 1.00

    I am using RoundDown function which was built in in Excel. This function Returns the 1.00 as Ouput of my Values.

    I am retrieve values from excel sheet to TC, This 1.00 which were in excel sheet not return as it into TC. It is displaying as 1 instead of 1.00. Here is my code.
    My code:
    Set XLSDriver = DDT.ExcelDriver(FilePath, "RoundDownSheet")
    While Not XLSDriver.EOF
    XLSInputTwo = aqConvert.VarToStr(DDT.CurrentDriver.Value(3))
    Call XLSDriver.Next() ' Goes to the next record
    WEnd

    Here : I am grabing the value from excel sheet with below method

    aqConvert.VarToStr(DDT.CurrentDriver.Value(3))

    The value in excel sheet is 1.00

    I am getting 1 instead of 1.00 into Declared "XLSInputTwo " variable

    How can i get the exact value from excel sheet to TC?

    Thank you
    Raj

    RajeshKumarUriti@gmail.com

  2. #2
    SQA Knight
    Join Date
    May 2006
    Location
    Playa Del Rey, California, United States
    Posts
    2,596
    Post Thanks / Like
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Re: XLSDriver Returns 1 instead of 1.00

    What you need to do is set a registry entry that'll tell the ODBC driver handling the excel call (the one that comes preinstalled in windows) to treat all data as strings. By default it will assume all numeric values as numbers. Since 1.00 is the same as 1, it will treat it that way.

    Other wise you'll have to set the property of that column to a String type, but that won't allow you to enter equations or macros into those cells and you won't be able to round.
    David Lai
    SDET / Consultant
    LinkedIn profile

  3. #3
    Member
    Join Date
    May 2008
    Location
    Visakhapatnam
    Posts
    33
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: XLSDriver Returns 1 instead of 1.00

    Converting into string in a excel is hard to me because i have more data and I will enter in future also.

    You are right 1.00 is equal to 1 but if we asked to student strictly rounded to decimal place, 1.00 is correct. I did some programs in vb with Rounddown function and return the value 1.00, now I am trying to check my vb program with TC. But TC retreview the data as 1 eventhough having 1.00 in excel sheet.

  4. #4
    Senior Member
    Join Date
    Aug 2006
    Posts
    1,920
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: XLSDriver Returns 1 instead of 1.00

    Hi,

    If a variable contains a numerical value (its type is not string), this value is not formatted in any way - it's just a number, and if it doesn't have the fractional part, you will not see it when, for example, evaluating the variable's value. This is absolutely normal.

    To see values with fractional parts even if they're equal to 0, you need to convert numbers to strings and format them in the way you need. To do this, use the aqString.Format method in your script (see the "aqString.Format" help topic).
    Jared - AQA Support

  5. #5
    Member
    Join Date
    May 2008
    Location
    Visakhapatnam
    Posts
    33
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: XLSDriver Returns 1 instead of 1.00

    Thank you for aqString.Format.

    Hello Jared

    You create one execel sheet and give value 1.00 and try to call this value in TC with aqString.Format.

    It is retrun the Method not set Error. You can try this. Anyhow thankyou. I am using Formatnumber function.

    I find out one more solution that is "Formatnumber" built in function which was supplied by TC.

    FormatNumber(1,2)

 

 

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 10.71%
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 06:13 PM.

Copyright BetaSoft Inc.