Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
rohitk1609
Master
Master

Exit Script not working

Hi Techies,

I have written one application which has three nested loops, two FOR loop and one DO WHILE then exit script and there are another tabs which have some old code. I executed below code two or three times in my script is was executed fine.

Temp_0:

load

*

Inline

[

FIELD_CATEGORY

ABC/

CDE/

EFG/

](delimiter is '/');

Let c=1;

FOR c = 1 to  NoOfRows('Temp_0')-1

TEMP:

Load

*

inline

[

FIELD

ABC

DEF

GHI

];

let a=1;

FOR a = 1 to NoOfRows('TEMP')-1

let Var=FieldValue('FIELD',$(a));

let vCountry = SubField(Var,'|',2);

////////Weekly Loop///////

let vToday = num(now())-14;

let b= '42442';

Do while b <= vToday

let vmessage='';

let b=b+7;

Loop

NEXT a

Next c

exit script

//old code//

but suddenly it was started through error which is :

The control statement is not correctly matched with its corresponding start statement

               Next a



Then I deleted the tables after EXIT SCRIPT and script is started running fine.

My problem is why script is not working if there is old code after exit script ?

Thanks in Advance!

Rohit

10 Replies
petter
Partner - Champion III
Partner - Champion III

The statements after EXIT SCRIPT are still parsed to catch any pre-execution detectable syntax errors.

So that is the reason. I would rather use a block comment with /* and have the */ at the very end of the script - that way you don't need to figure out the problem with your old code.

arvind1494
Specialist
Specialist

Use exit script at the end of script

and don't forget to use ; at the end of statement

rohitk1609
Master
Master
Author

It is very sad to know code executes even after EXIT SCRIPT;

petter
Partner - Champion III
Partner - Champion III

The code is not executing - it is being parsed - validated that it has correct syntax. Parsing and executing are two very different things.

petter
Partner - Champion III
Partner - Champion III

You don't need to use a ; at the end of a control statement like EXIT SCRIPT. It doesn't do any - but it is unnecessary.

petter
Partner - Champion III
Partner - Champion III

Parsing is a good thing to be able to catch any errors as soon as possible. The disadvantages are minor ... the only thing is that you will have to use commenting instead of just EXIT SCRIPT. Why don't you correct the syntax errors? Then you can continue to use EXIT SCRIPT.

rohitk1609
Master
Master
Author

Hey Petter,

I got your point. Parsing means it looks for any syntax error. If it is not executing it will not load any script outcome data to application, it will just tell me that post exit script there is any error or not. like in my case, why my loop before exit script is failing because loop start from a=1 and post script there is a value 15 in variable a ,  so all time it was saying starting of loop condition won't work. I tried to set variable a definition before exit script or before any loop code but it was taking the value of variable post exit script.

Thanks Petter. from now will use /* instead of exit script.

petter
Partner - Champion III
Partner - Champion III

You're welcome. Please mark this question as answered so the thread gets closed and marked as such.

marcus_sommer

Maybe there are some exceptions to the general rule hinted from Petter. At least in QV 10 the in this release undocumented feature of must-include was executed after an exit script statement. I don't know if this had now changed.

- Marcus