Forum Discussion

fmendes's avatar
fmendes
Contributor
13 years ago

Project Object Variable

I am trying to save an object to be used from multiple script routines or keyword tests. The problem I am having is that the value gets reset after the script function is executed i.e.


The value of the Project.Variables.MappingGrid is null when I run the code from another keyword test.


<code>

function StoreMappingGrid( grid )

{

  if(Project.Variables.VariableExists("MappingGrid"))

  {

    Project.Variables.RemoveVariable("MappingGrid");

  }

 

  Project.Variables.AddVariable("MappingGrid", "Object");

 

  Project.Variables.MappingGrid = grid;

 

}


function ValidateMappedData()

{

  var mappingGrid = Project.Variables.MappingGrid;

}

</code>

  • Hi,


    As I understand, you are calling the StoreMappingGrid function from the keyword test to store the grid object to the variable. Is there any reason why you do not want to save the grid object to the variable directly from the keyword test by using the Set Variable Value operation?


    Where are you using the ValidateMappedData function?


    To help us reproduce the problem, could you please send us your project or a screenshot of your keyword test?