NT
10 years agoContributor
How to refresh a DB Table Variable in a Loop
Hi,
I would like to continue to a second KeywordTests base on a field that is update in a Database.
So in terms of word.
I execute Test1 and would like to execute Test2 only if the Field <Statut > in the Table CPF_Statu is equel to <P>.
I can access to the field in the Database using DB Table variable type but it never refresh the content of the field. It stays always on the same first read.
How can I do that by script or by KeywordTests ?
Best regards
Without seeing your setup in person I would do something like this.
At the end of Test1 Run this script (obviously filling in the details).
function checkStatut() { var dbConnection, record, statut; dbConnection = ADO.CreateADOConnection(); dbConnection.ConnectionString = "connectionString" dbConnection.LoginPrompt = false; dbConnection.Open() record = dbConnection.Execute_("sql query"); statut = record.Fields("Statut").Value; if (statut == "<P>") KeywordTests.Test2.Run(); //assuming Test2 is a keyword test
}- thanks it work fine, but now if the Statut become at value P only after a certain time so it means that I need to refresh the information of the statut by reading the information in the database until it becomes at value P. It is a delay treatment. is it possible to use a Loop to wait until the statut become at value P ? thanks a lot for your help !!!
Sure try something like this:
function checkStatut() { var dbConnection, record, statut; dbConnection = ADO.CreateADOConnection(); dbConnection.ConnectionString = "connectionString" dbConnection.LoginPrompt = false; dbConnection.Open() while (statut != "<P>") { record = dbConnection.Execute_("sql query"); statut = record.Fields("Statut").Value; if (statut == "<P>") KeywordTests.Test2.Run(); //assuming Test2 is a keyword test } }