Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

If table is empty then do nothing else do

At the moment I try to optimize a bidirectional connection between an interface database and a Sage database.
I nearly solved the whole problem. I still have one big problem.
The data goes from one mysql table to one or more mssql tables. If there is no content in the mysql databas the job
should not run. If there is content the job should run.
At the moment the job runs under an inifinite loop. This is no good solution.
Where and how to place the statement?
Labels (2)
5 Replies
Anonymous
Not applicable
Author

Hi
To determine a table is empty or not, only select one row from the table, for example:
tMysqlInput_1--main--tJavaRow
|
tJava---runIf---next processing
on tMysqlInput_1, write the query as below:
"select * from tableName limit 1"
There is a global variable ((Integer)globalMap.get("tMysqlInput_1_NB_LINE")) counts the total number of rows are queried.
on tJava:
if(((Integer)globalMap.get("tMysqlInput_1_NB_LINE"))>0){
globalMap.put("isContinue",true);
}else{
globalMap.put("isContinue", false);
}
set the condition of runIf as:
(Boolean)globalMap.get("isContinue")
The next processing will fires if the table has at least one row.
Best regards
Shong
Anonymous
Not applicable
Author

Thank you, for your help! But how to integrate the solution in my case?
Anonymous
Not applicable
Author

Hi
I think u need to try tWaitForSqlData
Anonymous
Not applicable
Author

Great idea, but where to place in my job?
Anonymous
Not applicable
Author

Hi ,
You can use this instead of infiniteLoop, as the loop will only start when there is data in the table or data is inserted.