Evaluating the value of a variable in OpenScript
726311Oct 13 2009 — edited Oct 15 2009I am attempting to navigate through screens and views based on a spreadsheet containing the applicable screens/views. I am using variables based on a dataset which I have been successful in substituting into the various method calls to change views, etc. What I am attempting to do is use the value of the variable in an "if" condition statement to drive the flow of the script. I have tried referring to it directly and have also tried setting it to a different variable and referencing it. Neither approach worked (I've commeted out some of the approaches). Instead of using the value, it appears to be using the literal string which prevents the usage of the variable (I know this from the result of the test since it calls gotoScreen instead of gotoView as well as the showMessageDialog which displayed the literal string of {{db.ViewList.ScreenName}}. I have also tried testing the reverse logic (if ("{{db.ViewList.ScreenName}}" != "Accounts Screen")) which also helps prove that it's not working. Here is the code snippet:
for (int i = 0; i < 70; i++)
{
getDatabank("ViewList").getNextDatabankRecord();
// String sScreenName = "{{db.ViewList.ScreenName}}";
// getVariables().set("vScreenName", "{{db.ViewList.ScreenName}}");
// String sScreenName = getVariables().get(vScreenName);
// JOptionPane.showMessageDialog(null, "Screen Name is: " + sScreenName);
// JOptionPane.showMessageDialog(null, "Screen Name is: {{vScreenName}}");
// if (sScreenName.isEmpty() || sScreenName == null)
// if (sScreenName.length() == 0)
// if (sScreenName != "Accounts Screen")
if ("{{db.ViewList.ScreenName}}" == null || "{{db.ViewList.ScreenName}}" == "")
{
siebelFT
.pageTabs(
114,
"/siebelft:cas[@ClassName='SiebApplication' and @RepositoryName='Siebel Automotive']/siebelft:cas[@ClassName='SiebPageTabs' and @RepositoryName='SiebPageTabs']")
.gotoView("{{db.ViewList.ViewName}}");
} else
{
siebelFT
.pageTabs(
82,
"/siebelft:cas[@ClassName='SiebApplication' and @RepositoryName='Siebel Automotive']/siebelft:cas[@ClassName='SiebPageTabs' and @RepositoryName='SiebPageTabs']")
.gotoScreen("{{db.ViewList.ScreenName}}");
}
web.window(83, "/web:window[@index='0' or @title='Siebel Automotive']")
.waitForPage(null);
{
think(7.711);
}
} // End For Loop
-John