Forum Discussion

bdrummond's avatar
bdrummond
Contributor
7 years ago

Object.Save() type-mismatch error - cannot save a property to TC Objects

 was wondering if TC cannot store a property of an object as Test Complete Object?

 

I have tried to save an object, but more precisely, trying to save the wText property of a title box as an object - so then i can verify it later on.

 

Any suggestion, of a better practice on how to store this wText as object and then use it for a checkpoint later on the test?

 

//Script unit to replace exising chart title to be saved.
//

//import unit uniqueID
var impUnit = require("uniqueId");

function chartTitle(){
  var ic = Aliases.IC;
  var getTitleBox = ic.saveChartAsForm.titleTxtBox;
  var x = impUnit.getObject(); //Retrieve the result of function uniqueId() from other unit.
  
  //set random number onto the title
  getTitleBox.SetText(x);  
  Log.Message("This is the randomly generated chart name: " + x);
    
  //Get the String object under title txt box
  var a = getTitleBox.wText; //----> this wont work...(?)<----
  var x = a;  
  Log.Message(x);
  
  //Prepares the property name
  propertyNames = "Generated Chart ID";

  //Save object into Objects in TestComplete
  Objects.Save(x, propertyNames);
  
}

I have attach an image to better understanding what i am trying to do.

 

Much appreciate it for any advise.

 

regards,

 

BD