Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ecabanas
Creator II
Creator II

Error Load Script

Hi

I have this script and give an error, did you know why?

LET vExecTime=UTC();

Set vLastExecTime=0;

if (not IsNull(QvdCreateTime('$(VStore)INVENTTRANS_INCREMENTAL.qvd'))

,

LoadTime:

Load Max(LastModifiedDate)as LastModifiedDate

From $(VStore)INVENTTRANS_INCREMENTAL.qvd(qvd);

Let vLastExecTime=peek('LastModifiedDate',0,'LoadTime');

Drop Table LoadTime;

);

Many thank's

1 Solution

Accepted Solutions
ramoncova06
Specialist III
Specialist III

yes the "if" and "then" have to be in the same line

View solution in original post

6 Replies
ramoncova06
Specialist III
Specialist III

use an if ... then instead of if ()

If..then..elseif..else..end if

The if..then control statement is a script selection construct forcing the script execution to follow different paths depending on one or several logical conditions. The syntax is:

if condition then

  [ statements ]

{ elseif condition then

  [ statements ] }

[ else

  [ statements ] ]

end if

Where:

condition is a logical expression which can be evaluated as true or false.

statements is any group of one or more QlikView script statements.

Since the if..then statement is a control statement and as such is ended with either a semicolon or end-of-line, each of its four possible clauses (if..then, elseif..then, else and end if) must not cross a line boundary.

Examples:

if a=1 then

load * from abc.csv;

sql select e, f, g from tab1;

end if

if a=1 then; drop table xyz; end if;

if x>0 then

load * from pos.csv;

elseif x<0 then

load * from neg.csv;

else

load * from zero.txt;

end if

ecabanas
Creator II
Creator II
Author

Hi Ramon,

Many thank's but still with problems 😞

see the picture

Eduard

rubenmarin

Hi Eduard, following Ramon instructions:

Since the if..then statement is a control statement and as such is ended with either a semicolon or end-of-line, each of its four possible clauses (if..then, elseif..then, else and end if) must not cross a line boundary.

ramoncova06
Specialist III
Specialist III

yes the "if" and "then" have to be in the same line

ecabanas
Creator II
Creator II
Author

Hi Ruben, But i did not understand 😞

ecabanas
Creator II
Creator II
Author

Many many thank's Ramon!!!!