Jscript - Object doesn't support this property or method
Been away from TestComplete for a few months and when recently modifying one of my scripts, am now encountering the following error. My application is a Java Swing based app and I'm using Jscript as my TC coding language.
Object doesn't support this property or method
Error location:
Unit:
"QA_Data_Fill\QA_Data_Fill\Script\Service_Provider"
Line: 159 Column: 10.
Here's what I'm doing:
1) Click on a tab in the application which contains a Java table.
2) Execute a MySQL query to get the list of values that need to be set in the table.
3) Execute an Oracle query to determine the object type of the object and set that to the variable textField.
4) Click on the field based on step 2)
5) Populate that field based on object type determined in 3.
I used to run the query in 3), then set the object type variable in a Switch statement. I thought it might be more efficient to just move it up into 3)'s case statement. However, I'm getting the Object doesn't support error. Why would this be? If I record the script, just clicking on the same fields and populating, they look exactly like I'd think the code with the variable should look. I'm stumped. Thanks.
serviceProviderPropertySheet.TabbedPane.ClickTab("Properties");
propertyTable = serviceProviderPropertySheet.TabbedPane1.Panel.Panel.ScrollPane.Viewport.PropertyTable;
//Get the property data
var spPropQry = "SELECT locale, property, propertyvalue " +
"FROM serviceprovider_properties " +
"where serviceprovider = '" + spNm + "';";
var spProp = DDT.ADODriver(ProjectSuite.Variables.varConStrMySQL, spPropQry);
//populate the property data
while(!spProp.EOF())
{
var spLocale = spProp.Value(0);
var spProperty = spProp.Value(1) ;
var spPropertyVal = spProp.Value(2) ;
RowIndex = propertyTable.FindRow(0, spProperty);
if (RowIndex != -1)
{
//Get the property type from C3C Database
var spPropTypeQry = "SELECT dd.abbreviation, dd.pk_locale_code, df.property_type_code, df.property_type_pkg_sid, pp.\"VALUE\", "+
"CASE when df.property_type_code = 'SimpleString' then 'propertyTable.TextField' WHEN pp.\"VALUE\" LIKE '%PropTypeComboBox%' THEN 'propertyTable.PropTypeComboBox.TextField' WHEN pp.\"VALUE\" LIKE '%PropTypeTextField%' THEN 'propertyTable.PropTypeTextField' ELSE 'propertyTable.TextField' END AS PropType "+
"from AD_SPROV_PRP_D dd "+
"LEFT JOIN AD_SPROV_prp_def df ON dd.NAME = df.NAME "+
"LEFT JOIN PROP_TYPE P ON df.property_type_code = p.property_type_code AND df.property_type_pkg_sid = p.property_type_pkg_sid "+
"LEFT JOIN PROP_TYPE_PRM PP ON P.PROPERTY_TYPE_CODE = PP.PROPERTY_TYPE_CODE AND p.PROPERTY_TYPE_PKG_SID = pp.PROPERTY_TYPE_PKG_SID And pp.PARAMETER_CODE = 'editorClassName' "+
"where pk_locale_code = '" + spLocale + "' and abbreviation = '" + spProperty + "'";
//set the control type based on what's pulled from the database.
var spPropType = DDT.ADODriver(ProjectSuite.Variables.varConStrOracle, spPropTypeQry);
var counter = 0
while(!spPropType.EOF())
{
if (counter>1)
{
Log.Error("ERROR - More than one row returned from properties query " + textField + " " + counter);
}
textField = spPropType.Value(5);
Log.Message("textField = " + textField);
counter = counter+1 ;
spPropType.Next();
}
propertyTable.ClickCell(RowIndex, 1);
//set the property value
if (spProperty == "Enable Endpoint Pooling")
{
textField.Keys("^a"+spPropertyVal);
Aliases.javaw.dialog04.RootPane.null_layeredPane.null_contentPane.OptionPane.OptionPane_buttonArea.OptionPane_button.ClickButton();
textField.Keys("[Tab]");
}
else
Log.Message("spPropertyVal = " + spPropertyVal);
Log.Message("textField = " + textField);
textField.Keys("^a"+spPropertyVal+"[Tab]");
}
else
Log.Warning("Warning" + spProperty+ "not found in Properties Table");
spProp.Next();
}