Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
CUSTOMERS ONLY: Now accepting customer applications for the 2023 Luminary Program: SUBMIT NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count in script load not possible ?

Having search the forum for days I can't understand why my load doesn't work. I want to do a simple count(field) as CountedField in my load, but the log shows General script error. My syntax is:

Load *,

count(field) as CountedField

Resident Table

Sort by field;

I have also tried with group by instead of sort by but same error occours. Any ideas ?

3 Replies
maneshkhottcpl
Partner - Creator III
Partner - Creator III

Hi,

You cannot use count like this, u must use aggregate function for it.

i.e. load count(Field1) as CountF1, Field2 resident xTab group by Field2

the fields u arer using in ur load must group by except count or sum fields.

Not applicable
Author

Hello,

I think using the group by is correct. In this case you have to list all fields to be grouped that means "group by field1, ..., fieldn;" with only one exception: the count-field itself. I am quite sure that a wildcard is not allowed here, you have to list all fields in the LOAD as well as in the group by -clause. This is my experience.

Regards, Roland

Not applicable
Author

1. You should use Group By

2. In Load statement must be only fields that are used in Group By statement and aggregation functions

For example:

Load
Field
,count(Field) as cnt
Resident Table
Group By Field;