Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
dineshmdane
Partner - Contributor III
Partner - Contributor III

How to exit the script based on condition?

Dear All,

Exit the script based on condition on reload.

For Example:

if 'Id' is equal to 37 then the script should continue execution

else the script should stop its execution at that point and  'EXIT Script' should be activated or executed. 

Kindly awaiting for your response.

Thanks & Regards,

Dinesh M

7 Replies
sunny_talwar

What is Id here? Is this a field or a variable?

Anonymous
Not applicable

if (id=37) then

EXECUTE

else

  LET vStop = Now();

  EXIT Script;

End If

just try like this it may works

Anil_Babu_Samineni

Can you share full script? I mean before IF condition what you have done

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
its_anandrjs

Try this way

LET X = 37;
LET vVar = 37;

if $(X) = $(vVar) then

LOAD * Inline [
Col
a
b
c
d ]
;

else

EXIT Script;

end if

Regards

Anand

dineshmdane
Partner - Contributor III
Partner - Contributor III
Author

Hi Sunny,

'Id' is a field for which the values are given using input function.

Regards,

Dinesh M

sunny_talwar

Can it always have one value assigned to it? Can you may be share a sample so that we can see your setup?

dineshmdane
Partner - Contributor III
Partner - Contributor III
Author

Kindly find the below script that I have and there is no binary load.

LOAD

Input('Enter your ID','Input' ) as ID,

Input('Enter the Name','input' ) as Name

AutoGenerate(1);

//----------------

// condition

//----------------

//-------------------------

// remaining script

//--------------------------

if the condition is true the 'remaining script' has to execute else script has to exit.

Thanks & Regards,

Dinesh M