Forum Discussion

BernardFanthom's avatar
BernardFanthom
Contributor
10 years ago
Solved

I am running an If Then command to compare the values from my Excel Data sheet and a variable I have

I am running an If... Then... command to compare a value extracted from my Excel Data sheet with a variable I have declared and set to the content of a combobox (VB6).

 

The comparison is constantly failing even though when I 'eyeball' them, the 2 values are identical.

 

Should I trim both values? I noticed there is a VB declaration for a TRIM method. Can I just call this or must I declare it in a functions library which I would call from my script?

  • BernardFanthom's avatar
    BernardFanthom
    10 years ago

    Apologies all. I can see the logging again.

     

    Many thanks Marsha! - Big help!

  • Trimming sounds like a good idea - I'm not sure about VB but if you are scripting in JScript you can call like this:

     

    aqString.Trim(InputStringSpace)

     

    Also trimming both values will ensure you are comparing Strings and no different types.

    • BernardFanthom's avatar
      BernardFanthom
      Contributor

      Thanks for feedback. At present I am trying to see if there is any way I can view the values on screen in a message box to find out what the hell they contain.

       

      I believe there is such a method in the builtin dll called showmessage?

       

      Is there any way to check if I have this other than the Programs install/uninstall route?

       

      Anyone have similar VB code to hand that I could slap into my functions library script.

      • BernardFanthom's avatar
        BernardFanthom
        Contributor

        I am now exploring doing a property checkpoint. For object X Property wText Equals <Value>.

         

        However I would like to use a variable for <Value>. Can I do this?

  • NisHera's avatar
    NisHera
    Valued Contributor

    Easiest way is put a log and see the deference ...then you can deside which way to handle that

     

    Log.Message(Variable1+'   '+ Variable 2 ) in jscript

    or Log.Message(Variable1 &'  '& Variable 2) in vbscript

    • BernardFanthom's avatar
      BernardFanthom
      Contributor

      Thanks for the feedback Nishera. I have tried using the log command and it does not work. Is there anything I should check to see if logging is switched off?

      • BernardFanthom's avatar
        BernardFanthom
        Contributor

        Apologies all. I can see the logging again.

         

        Many thanks Marsha! - Big help!