Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
christian77
Partner - Specialist
Partner - Specialist

Variables are not ceated in script

Hi:

I have this simple script:

LET vL.StartingDate = num(YearStart(today()));       

LET vL.EndingDate = '20130131';   ////num(today());                                
Calendar:

LOAD
date(recno()+$(vL.StartingDate)-1,'YYYYMMDD')             as SDate

autogenerate($(vL.EndingDate)-$(vL.StartingDate)+1);

for i = 0 to 1 ///NoOfRows(CalendarSAP)-1   /// Uncomment later. It works fine with NoOfRows

LET  vL.LoopingDate = peek('SDate',$(i),'Calendar');
trace $(vL.LoopingDate);

MYTABLE:LOAD date,
    
field1,
    
field2FROM
[prueba.xls]
(
biff, embedded labels, table is [Sheet1$])where date = $(vL.LoopingDate);
next i;
LET vL.Filas = NoOfRows(MYTABLE);   ////DON'T WORK. WHAT CAN I DO

LET vL.Columnas = NoOfRows(MYTABLE); ////DON'T WORK. WHAT CAN I DO

Store * from MYTABLE into MYTABLE.QVD;

//Drop table MYTABLE;

vL.Filas and vL.Columnas don't get created. How can I get that information?

Thank you.

1 Solution

Accepted Solutions
flipside
Partner - Specialist II
Partner - Specialist II

Hi Christian,

Only single quotes around the table name, and no square brackets.  This should work.

flipside

View solution in original post

11 Replies
Not applicable

Hi Christian


Try the following,





LET vL.Filas = NoOfRows('MYTABLE');   ////DON'T WORK. WHAT CAN I DO

LET vL.Columnas = NoOfRows('MYTABLE'); ////DON'T WORK. WHAT CAN I DO




Steve

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Use quotes:

LET vL.Filas = NoOfRows('MYTABLE');

Another issue - I don't know if this is directly related to your problem, but its possible your vL.EndinfDate is not being handled correctly. Rather use:

LET vL.EndingDate = Num(Date#('20130131', 'YYYYMMDD'));


Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
christian77
Partner - Specialist
Partner - Specialist
Author

Hi.

Thanks for answering.

I've tryed already wiht quotes. It does not work.

Regarding the format. Yes, I modified the script for you to test it. The format was fine before I commented, but that's not the issue.

I just want to know how many rows and fields has a certain table, assign those values to variables, and then drop the table. That way I can make a load proof and check the performance without having to check the QVD. I want to have it on the screen right after I load.

Thank again.

Not applicable

Christain

Just to confirm, you are using the single quotes like ' and not the double quotes like  "  ?

Steve

jonathandienst
Partner - Champion III
Partner - Champion III

Then it is likely that the table does not exist. If the Where clause returns no records, the table will not be created. You can test for the existence of a table by

LET vL.Filas = Alt(NoOfRows('MYTABLE'), 0);

This will return 0 if the table is empty or does not exist.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
christian77
Partner - Specialist
Partner - Specialist
Author

Hi:

 

let vL.Filas = NoOfRows ([O_ORCO_1] );
let vL.Filas2 = NoOfRows ('[O_ORCO_1]');
let vL.Filas3 = NoOfRows ("[O_ORCO_1]");
LET vL.Filas4 = Alt (NoOfRows([O_ORCO_1]), 0);
LET vL.Filas5 = Alt(NoOfRows('[O_ORCO_1]'), 0);

First 3 not created. Other 2 created with 0 value. It's curious since I haven't droped the table. Any workarround?

NoOfRows.png

flipside
Partner - Specialist II
Partner - Specialist II

Hi Christian,

Only single quotes around the table name, and no square brackets.  This should work.

flipside

Not applicable

Christain

Do not use the square bracket [] when using the single quotes.  This should then work.


Steve

flipside
Partner - Specialist II
Partner - Specialist II


Also, does your code work if you put single quotes in the WHERE clause in the loop section? ...

(biff, embedded labels, table is [Sheet1$])where date = '$(vL.LoopingDate)' ;