Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

LOAD TABLE/ AUTOGENERATE

Hello all,

I am new with the QV and working on the training.

I can't load the resident table I create, here is the script

 

Tempcalendar:

LOAD

$(VARMINDATE)+ROWNO()-1 AS DATENUMBER,

DATE ($(VARMINDATE)+ROWNO()-1) AS TEMPDATE,

AUTOGENERATE $(VARMAXDATE)-$(VARMINDATE)+1;

no error message pops up,

The debugger shows,

VARTODAY41301

VARMAXDATE<NULL>

VARMINDATE<NULL>

Is there something wrong with the autogenerate?

THANK YOU!  

4 Replies
Not applicable
Author

You have a syntax error due to the comma before AutoGenerate. But I think your problem should be in the variable assignments. If you try the following script, it will work:

SET VARMINDATE = MakeDate(2012, 1, 1);

SET VARMAXDATE = MakeDate(2012, 12, 31);

   

Tempcalendar:

LOAD

$(VARMINDATE)+ROWNO()-1 AS DATENUMBER,

DATE ($(VARMINDATE)+ROWNO()-1) AS TEMPDATE

AutoGenerate $(VARMAXDATE)-$(VARMINDATE)+1;

JG

Not applicable
Author

JG Thanks

but,

I've tried to remove the comma, but I get an "ERROR IN EXPRESSION" message in the debugger.

 

regarding the SET function, I cannot put specific dates I must use the min and the max dates of the ORDERDATE field of the ORDERS table.

again thanx

 

 

Not applicable
Author

OK, then take a look at this one:

Directory;

DatesTable:

LOAD A AS LoadedDates

FROM

Dates.xlsx

(ooxml, no labels, table is Dates);

MaxMinDates:

LOAD

          Max(LoadedDates) AS MaxDate,

          Min(LoadedDates) AS MinDate

Resident DatesTable;

VARMINDATE = Peek('MinDate');

VARMAXDATE = Peek('MaxDate');

 

Tempcalendar:

LOAD

$(VARMINDATE)+ROWNO()-1 AS DATENUMBER,

DATE ($(VARMINDATE)+ROWNO()-1) AS TEMPDATE

AutoGenerate $(VARMAXDATE)-$(VARMINDATE)+1;

Not applicable
Author

it works this way,

 

I commented out the initial script and created the Dates file.

 

However, what happens with the script from training?