Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
thomas_evans
Partner - Contributor III
Partner - Contributor III

Autogenerate count is out of range?

Hi there,

I have implemented a canonical calendar and master calendar per some information I found online which utilizes a sub routine to spawn off the common calendar and optionally you can spawn off master calendars for each date attribute.

For some reason when I try and create the master calendars it fails due to an out of range value:

The following error occurred:

Autogenerate: generate count is out of range

The error occurred here:

LOAD FieldValue('BirthDate', RecNo()) as datefield AutoGenerate FieldValueCount('BirthDate'

I've had a look at the date field data in the SQL Server database and it is a date datatype, and there are no "odd" looking values in there. I've also done an ORDER BY in my load, neither of these seem to resolve the issue. Can anybody explain what can cause an out of range error when handling dates? I suspect that Qlik is doing something under the hood?

Thanks!

1 Reply
petter
Partner - Champion III
Partner - Champion III

You should calculate the FieldValueCount('BirthDate') before the load and check if you get a valid number. If you don't have a field named BirthDate already loaded the error message you got is exactly what you would get.

Be aware that FieldValueCount() returns the number of DISTINCT values of the field.... not necessarily the same as the number of rows in the table that the field belongs to. Peek() might be the best alternative for most purposes