Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

ecabanas
Not applicable

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
Not applicable

Re: Error Load Script

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

6 Replies
ramoncova06
Not applicable

Re: Error Load Script

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
Not applicable

Re: Error Load Script

Hi Ramon,

Many thank's but still with problems :-(

see the picture

Eduard

rubenmarin
Not applicable

Re: Error Load Script

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
Not applicable

Re: Error Load Script

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

ecabanas
Not applicable

Re: Error Load Script

Hi Ruben, But i did not understand :-(

ecabanas
Not applicable

Re: Error Load Script

Many many thank's Ramon!!!!