Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
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

1 Solution

Accepted Solutions
swuehl
MVP
MVP

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

View solution in original post

10 Replies
swuehl
MVP
MVP

Maybe just use the variable vTest instead of vCount?

IF  vTest >0 THEN

Not applicable
Author

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

swuehl
MVP
MVP

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
Specialist
Specialist

seems like you are missing semicolon

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

Not applicable
Author

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

swuehl
MVP
MVP

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
Partner - Creator
Partner - Creator

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
Specialist
Specialist

PFA

seems to be working without an error

Not applicable
Author

Thanks Stefan.

Condition work fine.

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

Thanks,

Rohit