Forum Discussion

trajmo's avatar
trajmo
Occasional Contributor
6 years ago

Format for numeric value

Hello,

I am trying to specify a property checkpoint for my fild which contains numbers, to check the format, in the code of my desktop application in Delphi is specified #,##0.00, how can i do it with the same format to be checked in my keyword.

Thanks,

  • Now it's clear... so, you're simply wanting to make sure that the contents of the property match a particular format.

    So...  When setting up your property checkpoint, one of the options in the "Condition" parameter is "cmpMatches".  When you select that, then in the "Value" parameter, you enter the regular expression for the format you want as a "String", not a code expression.

  • In the blank space in the value field I believe should be the regular expression for the format that you're wanting to check... and yes, it is a "number" techincally, but the wText field in the object is a string property.

    You MAY end up not being able to use the built in property check point but might need to write a script routine that you call from within your keyword test to do the validation/check of the contents.  Again, regular expressions are going to be your friend here.

    • trajmo's avatar
      trajmo
      Occasional Contributor

      Thanks for your quick response.

      I am still trying to resolve my issue, i read all the articles for aqString.Format method but i cannot figure out how to do it. I am sending the printscreens of my error and my property check point expression.

      For sure i am wrong somewhere.

      In my code of the application the format in Delphi is specified by '#,##0.00'

      But i dont know how to do it in TC.

       

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Well, for one thing, the "Property" field should be the field that indicates which property of the object you're going to do a check against... you don't put the "aqString.Format" code in there....

        So... you're doing a property checkpoint... meaning you want to check that the value of a property matches an expected value.  So...  in your checkpoint, the "Object" field should be everything all the way up to but NOT including the "wText"... that should be set up as an "Onscreen Object".   The "Property" field should be a string containng "wText".

         

        It's the "Value" field where it sounds like you want to use the Code Expression for "aqString.Format".  Basically, this is where you're going to put in the value that you want to compare... 

        Start with that...