Forum Discussion

ashishnagpal26's avatar
ashishnagpal26
Contributor
8 years ago

How to assign a table variable value to NULL or default ( that is 0 * 0 )

Tool  : Test Complete version 12

Language used VB.

 

I have declared a project variable  as table and given default value as ( 0 * 0 )  .

 

During my test  I have used the above variable to populate some data and write the same to excel .

 

Now after my test completes I want this project variable to get its default value back ,

 

Can someone please help me out on this (a code snippet would be more helpful ) .

 

Thanks .

6 Replies

  • shankar_r's avatar
    shankar_r
    Community Hero

    We have two types of project variables.

     

    1. Temporary Variables - This variable lifetime only during execution. Once the execution completed it will turn into default values.

    2. Persistent Variables.

     

    For more details refer here.

    • ashishnagpal26's avatar
      ashishnagpal26
      Contributor

      Thanks :) 

       

      The issue was from a array which wasn't populating correctly.

       

       

  • m_essaid's avatar
    m_essaid
    Valued Contributor

    Hi,

    you don't need to set its value back.

    you just need to initialize its value correctly just before using it.

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Since it is a table variable, that means that it must be a temporary variable as m_essaid described.  Temporary variables do not persist values between project runs.  So, once you run a project, after it is completed, the variable will automatically reset to it's default as you described.

       

      I'm assuming, though, that since you're posting this question, something is not working as expected.  Can you supply a screenshot showing your project variable or the code that you are using to set it's values?

      • ashishnagpal26's avatar
        ashishnagpal26
        Contributor

        tristaanogre There was a issue with the array which was populating the table .

         

        But thanks from next time onwards I can post the question in a better way to make it more understable ( like posting picture etc )