Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
Not applicable

query on peek function

Hi,

I am facing some issue in the below load script:

test:

load *,

NoOfRows('TESTMain') as CountNO

Resident TESTMain;

Drop Table TESTMain;

Let vTest = peek('CountNO',0,'test')

if($(vCount)>0) Then

EXIT Script

Endif

I am getting script line error message in below lines

(if(>0) Then) ,

endif.

I am checking for null condition but not sure why the variable vTest does not returns any value.

Thanks in advance!!

Rohit

Tags (1)
1 Solution

Accepted Solutions
MVP
MVP

Re: query on peek function

Have you checked the variable content in script debugger or with a TRACE?

Note that you don't need dollar sign expansion in the IF statement:

IF vTEST > 0 THEN

Exit script;       // don't forget the semicolon...

END IF           // I believe it's written that way

10 Replies
MVP
MVP

Re: query on peek function

Maybe just use the variable vTest instead of vCount?

IF  vTest >0 THEN

Not applicable

Re: query on peek function

Hi Stefan,

It was a typo. I use the same but it not giving any value. It gives error message as stated in my earlier note.

Thanks,

Rohit

MVP
MVP

Re: query on peek function

Please post the exact script snippet content. There is easily a semicolon missing if you type it manually, e.g. after exit script:

Exit script;

In total, I think you just need

IF NoOfRows('TESTMain') >0 THEN

Exit script;

END IF

aarkay29
Valued Contributor

Re: query on peek function

seems like you are missing semicolon

Let vTest = peek('CountNO',0,'test') ;

Not applicable

Re: query on peek function

Hi,

I am redefine my load script but it is giving me error in IF condition i.e. if($(vTest)>0) .

test:

load *,

NoOfRows('TESTMain') as CountNO

Resident TESTMain;

Drop Table TESTMain;

Let vTest = peek('CountNO',0,'test')

if($(vTest)>0) Then

EXIT Script

endif

Thanks,

Rohit

MVP
MVP

Re: query on peek function

Have you checked the variable content in script debugger or with a TRACE?

Note that you don't need dollar sign expansion in the IF statement:

IF vTEST > 0 THEN

Exit script;       // don't forget the semicolon...

END IF           // I believe it's written that way

klausskalts
Contributor

Re: query on peek function

I normally use the NoOfRows() function to get the number of rows in a table directly.

Let vNoOfRows = NoOfRows('SalesTable');
Let vNoOfQVDRows = QvdNoOfRecords('QVD_SalesTable.qvd');

It's faster to execute and easier to maintain.

aarkay29
Valued Contributor

Re: query on peek function

PFA

seems to be working without an error

Not applicable

Re: query on peek function

Thanks Stefan.

Condition work fine.

Just one more thing does variable vTEST return NULL or give some numeric data.

Thanks,

Rohit