Forum Discussion

kimmatsumoto's avatar
kimmatsumoto
Contributor
7 years ago

logging results of a persistent variable

Hello,

 

When i executed this:

log.checkpoint('This is the value displayed in the Sabre Profile ID field: '+ProjectSuite.Variables.CBOSabreID0);

I get the error:  Could not convert variant of type (OleStr) into type (Double).

 

Attached is image of the persistent variable.

 

Could someone please advise me on what I'm doing wrong?

 

Thank you,

Kim

  • It's probably not liking that you're trying to append an integer to a string.

    Try the following:

     

    log.checkpoint('This is the value displayed in the Sabre Profile ID field: '+aqConvert.VarToStr(ProjectSuite.Variables.CBOSabreID0));

    This will do an explicity conversion to a string before the append.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    It's probably not liking that you're trying to append an integer to a string.

    Try the following:

     

    log.checkpoint('This is the value displayed in the Sabre Profile ID field: '+aqConvert.VarToStr(ProjectSuite.Variables.CBOSabreID0));

    This will do an explicity conversion to a string before the append.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Glad to hear it.

        Generally speaking, JavaScript allows for that kind of fluidity of data types.  However, TestComplete variables such as what are found in the Project Suite, Project, and Keyword tests don't always follow that rule.  It's always safe, even if using pure JavaScript, to not rely on the implicit conversion and to use the conversion utilities available in aqConvert.