Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
we have an ETL process where we record steps for each execution.
I am trying to call a procedure via load editor if the select criteria matches.
Example:
If
Select Step from table1 where Step=12
and Date=Current_date;
then
Call Procedure();
Exit Script;
Is this possible to achieve this logic ?
thanks in advance.
Assuming you've enabled non-select statements as per https://help.qlik.com/en-US/connectors/Subsystems/ODBC_connector_help/Content/Connectors_ODBC/How-to... - yes.
You would load whatever you're checking, use NoOfRows() or Peek() to check if any records were returned, and then based on that you would switch the IF statement logic,e.g.
Table1:
Select Something from Somewhere;
IF NoOfRows('Table1') >= 1 THEN
Do something
End if
Assuming you've enabled non-select statements as per https://help.qlik.com/en-US/connectors/Subsystems/ODBC_connector_help/Content/Connectors_ODBC/How-to... - yes.
You would load whatever you're checking, use NoOfRows() or Peek() to check if any records were returned, and then based on that you would switch the IF statement logic,e.g.
Table1:
Select Something from Somewhere;
IF NoOfRows('Table1') >= 1 THEN
Do something
End if
Thanks a lot for your suggestion, it worked.
However we need to check if this procedure has ran already or if this will be the first time it is executing based on the condition where it checked for NoOfRows >=1.
Below is the scenario what i am assuming.
If Step reached --> Run Procedure; // Running PROCEDURE for the first time.
If not reached --> no action
If Step reached--> Procedure already ran once --> Do Nothing.
Please suggest if above condition can be added as well ?
Set RunStatus=0;
IF RunStatus = 0 and ...
Then
Call Procedure
Set RunStatus = 1;
End if
Note that this will only check if you've attempted to run the procedure. If you want to know if the procedure actually did something / finished running, you would need to handle that on the data source side and then load the result.