Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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

Tags (2)
1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: No count in load script

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
7 Replies
MVP & Luminary
MVP & Luminary

Re: No count in load script

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
Not applicable

Re: No count in load script

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;

Not applicable

Re: No count in load script

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

Not applicable

Re: No count in load script

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

MVP & Luminary
MVP & Luminary

Re: No count in load script

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
Not applicable

Re: No count in load script

Thank you for your patience.

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

Not applicable

Re: No count in load script

Okay, it works like you said it.

count(@46) as Exemplarzählung

FROM...

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

Thank you so much!

Inga