Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

No count in load script

Hello users,

I have a problem with count in load script. It doesn't work, I think because there is no group by and no resident table. I don't know how to write the right command. The field "Signatur" is in the same table and has field @46.

Count_problem_script.jpg

Perhaps you can help me.

Thank you,

Inga

1 Solution

Accepted Solutions
Highlighted
MVP & Luminary
MVP & Luminary

Ok, let's try that again with a little emphasis this time

All the fields not used in an aggregation function, like count, need to be included in the group by clause at the end of the load statement

That really means all. Every field you load that is not used in an aggregation function must be included in the group by statement. If you load 10 fields and use two fields in aggregation functions that means you should have 8 fields in the group by clause.


talk is cheap, supply exceeds demand

View solution in original post

7 Replies
Highlighted
MVP & Luminary
MVP & Luminary

All the fields not used in an aggregation function, like count, need to be included in the group by clause at the end of the load statement:

Load A, B, count(C), D

from ...somewhere...

group by A,B,D;


talk is cheap, supply exceeds demand
Highlighted
Not applicable

load

signatur,

count(signatur)

resident tablename

group by signatur;

******************************

or also try this

load

A  ,  // field on the basis of it perform count

count(signatur)

resident tablename        

group by A;

Highlighted
Not applicable

Thanks Gysbert,

I think your answer is helpful for many people. But... on the screenshots you can see, that I not often work with SQL and functions.

But... I try... And I'm happy that it would be easy! When I know or better understand the answer, I will never forget it. Here's my nice try:

count_gysbert.jpg

Looks soooo nice. But doensn't work.

Greets,

Inga

Highlighted
Not applicable

Hey Vishwaranjan,

nice, it looks so easy, but it doesn't work. The field "Signatur" with A @46 is in the same table like "Exemplazählung" with A @19.

Perhaps I can make the group by at the end of this table, like I've done it with Gysberts answer.

count_vishvaranjan.jpg

I don't want to give up. :-S

Greets,

Inga

Highlighted
MVP & Luminary
MVP & Luminary

Ok, let's try that again with a little emphasis this time

All the fields not used in an aggregation function, like count, need to be included in the group by clause at the end of the load statement

That really means all. Every field you load that is not used in an aggregation function must be included in the group by statement. If you load 10 fields and use two fields in aggregation functions that means you should have 8 fields in the group by clause.


talk is cheap, supply exceeds demand

View solution in original post

Highlighted
Not applicable

Thank you for your patience.

Oooh, okay, there are 82 field that don't need a group by. Uiii, I have to try it.

Highlighted
Not applicable

Okay, it works like you said it.

count(@46) as Exemplarzählung

FROM...

group by @1, @2, @3 ... @83;

Thank you so much!

Inga