Forum Discussion

scristian_1's avatar
scristian_1
Occasional Contributor
15 years ago

Variables in stored objects value

Hi all,


I have a question if I can use variables in a stored object value.


I have a stored object with value property and I want to use a variable inside that is defined in the script


Example


In script I have var x=12


In stored object value I want to have www.test.com?id=x


And when I will do a compare between url addres and stored object value Testcomplete to replace x with 12 and the comparation to pass.


Can be done something like this? I only want to know how to reuse the variable x into the stored object value


Regards,

Cristian

  • Hi Cristian,


    Here's a sample script which updates a stored object's property:



    Objects.myObject.PropertyByName("myProperty").Value = "new value";

  • scristian_1's avatar
    scristian_1
    Occasional Contributor
    Thank you very much Allen



    I have a question. My object exists but I don't know how to find the PropertyByName. This is the answer received. Can you help me with finding the property?



    ---------------------------

    TestComplete

    ---------------------------

    An exception occurred in the "Unit1" unit at line 878:

    Microsoft JScript runtime error

    'Objects.Help_IE8.PropertyByName(...)' is null or not an object

    ---------------------------

    OK  

    ---------------------------



    Regards,

    Cristian
  • Hi Cristian,


    I need to take a look at your project suite. Please zip your entire project suite folder along with the log of the failed test execution and send us the archive via our Contact Support form (http://www.automatedqa.com/support/message). Make sure that messages in your log correspond to the latest version of your tests.