Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Aloru
Contributor
Contributor

Mastercalendar not working anymore

Hi,

i implemented a master calendar script a while ago and wanted to use it right now. Unfortunately it doesn't work anymore. There seams to be a problem with the variable generation but i cant pinpoint and solve the problem there following my google research.

i use following scrip:

MinMaxDateTable:
Load
    min(%MasterDate) as MinDate,
    max(%MasterDate) as MaxDate
resident ENBOProject;

let vMinDate = peek('MinDate',0,'MinMaxDateTable');
let vMaxDate = peek('MaxDate',0,'MinMaxDateTable');
let vToday = $(vMaxDate); // alternativ today()

drop table MinMaxDateTable;

TempCal:
Load
date($(vMinDate) + RowNo()-1) as TempDate
AutoGenerate ($(vMaxDate)-$(vMinDate)+1);

 

and get the error:

following error occurred:
Autogenerate: generate count is negative
 
error occurred here:
TempCal: Load date( + RowNo()-1) as TempDate AutoGenerate (-+1)
 
 
yes the min and max date fields are filled with data
 Proof.PNG
 
thanks
 

 

Labels (2)
2 Solutions

Accepted Solutions
marcus_sommer

It looked that you have applied some qualifying to your fieldnames - this needs to be considered if you tries to call any values from them per peek/fieldvalue. Probably better will be you disable all the qualifying and name all fields explicitly and keep the table-information only in those fields which they really add more value.

- Marcus

View solution in original post

marcus_sommer

Here in: let vMinDate = Num('01.01.2000'); you apply a string to the num-function which couldn't work even if this string has the standard date-format because this kind of data interpretation is only performed during the load.

In your case you need at first to apply a convert-function like:

num(date#('01.01.2000', 'DD.MM.YYYY'))

or you may use something like this:

num(makedate(2000, 1, 1))

- Marcus

View solution in original post

7 Replies
sunny_talwar

In that case, it might be an issue with the variables not getting created properly. Add TRACE to check there value

let vMinDate = peek('MinDate',0,'MinMaxDateTable');
let vMaxDate = peek('MaxDate',0,'MinMaxDateTable');
let vToday = $(vMaxDate); // alternativ today()

TRADE $(vMinDate);
TRADE $(vMaxDate);

May be try one of these alternatives for creating your variables

LET vMinDate = Peek('MinDate');
LET vMaxDate = Peek('MaxDate');

OR

LET vMinDate = FieldValue('MinDate', 1);
LET vMaxDate = FieldValue('MaxDate', 1);
Aloru
Contributor
Contributor
Author

Thanks for the help. 

Unfortunately i didn't get it working. The trace only outputs a empty string.

i tried both of your alternativ methods and also directly inserting the date in the code into the variable. Still empty variable.

marcus_sommer

It looked that you have applied some qualifying to your fieldnames - this needs to be considered if you tries to call any values from them per peek/fieldvalue. Probably better will be you disable all the qualifying and name all fields explicitly and keep the table-information only in those fields which they really add more value.

- Marcus

Aloru
Contributor
Contributor
Author

Thanks unqualifying helped with the input from the fields.

I still got problems when i input a date via script directly like:

let vMinDate = Num('01.01.2000');

Variables are empty and the script crashes.

Thanks in advance

Jonathan_Dienst
Partner - Contributor II
Partner - Contributor II

The fields may have values, but the variables do not. I don't see any problem with your script, but for some reason the peeks are not working.

Have you turned on Qualify? Your image makes it seem that the field names are prefixed by the table name.  If that is the case, use Unqualify * before the min/max load or use the full qualified names in the Peeks.

Aloru
Contributor
Contributor
Author

Yes i tried unqualify and it helped. The input from data base fields is now working thanks.

But i didn't get the direct date input via script like written above working. With that method the variables stay empty.

marcus_sommer

Here in: let vMinDate = Num('01.01.2000'); you apply a string to the num-function which couldn't work even if this string has the standard date-format because this kind of data interpretation is only performed during the load.

In your case you need at first to apply a convert-function like:

num(date#('01.01.2000', 'DD.MM.YYYY'))

or you may use something like this:

num(makedate(2000, 1, 1))

- Marcus