Press numbers on a Windows form app from SQL query
Hello everyone,
Not sure how to explain as simple as possible. So I have this kind of Windows form app buttons. and I have an SQL query which returns me some kind of numbers. Is it possible somehow to press these buttons depending on SQL query result. For example the SQL query returns number 56, then TestComplete needs to push number 5 then 6 and then button OK. Or SQL query returns number 186, then TestComplete needs to push number 1, then number 8, then number 6 and finally button OK.
HI Dainius,
Actual implementation depends on the data returned from the query and how you NameMapped buttons.
Assuming that:
-- Query returned string value; and
-- Buttons are NameMapped as Button1, Button2, ...
below is a sample untested pseudo-code:
var strQueryValue = <valueFromQuery>; // e.g. '12345'
for (var i = 0; i < strQueryValue.length; i++)
{
eval('Button' + strQueryValue.charAt(i)).Click(); // this will click Button1, Button2, ...
aqUtils.Delay(500); // short safety delay
}
...