Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

count in a script

Hi everybody

i gat a object like that (please see attached).

but the fields went from differents table so i use the applymap function and that's OK

The big issue is the fact that i want in this table count a field called 'FACTURE_INC.num_doc'.

I want export this table into csv after that's why i want all the field in a table


So i try this :

qualify*;

export:

load

applymap('GPE_CLIENT_map',FACTURE_INC.GroupeClient) as GPE_Cli, => OK

FACTURE_INC.andoc, => OK

FACTURE_INC.monthdoc, => OK

applymap('GPE_FOURNISSEUR_map',FACTURE_INC.GroupeFournisseur) as GPE_FRN, => OK

applymap('mapf',FACTURE_INC.CodifCreno) as Libelle_creno, => OK

FACTURE_INC.CodifCreno, => OK

FACTURE_INC.ArticleFournisseur, =>OK

count(FACTURE_INC.num_doc)  as gf => ERROR?

resident FACTURE_INDICATEUR group by [FACTURE_INC.num_doc]; => error?

How can i do this?


Sorry for my bad english

bless

3 Replies
petter
Partner - Champion III
Partner - Champion III

For an aggregation to work properly in a LOAD you will have to list all the non-aggregation fields in the GROUP by part of the LOAD.

That means that you will have to do either:

LOAD

     ApplyMap(.......) AS CPE_Cli,

     FACTURE_INC.anddoc,

     ....

     Count(....) AS gf

RESIDENT

     FACTURE_INDICATEUR

GROUP BY

     CPE_Cli, FACTURE_INC.anddoc, .....      // Everything except gf   !

;

I think that you might have to resort to a preceding load as the group by will not recognize the newly named (AS xyz) fields.

LOAD

     *

GROUP BY

     CPE_Cli,

     FACTURE_INC.anddoc,

    ....

;

LOAD

     ApplyMap() ....

     ....

RESIDENT

     FACTURE_INDICATEUR;

Not applicable
Author

excuse me,

like that?

qualify*;

export:

load

FACTURE_INC.andoc,

FACTURE_INC.monthdoc,

FACTURE_INC.CodifCreno,

FACTURE_INC.ArticleFournisseur,

count(FACTURE_INC.num_doc)  as gf

resident FACTURE_INDICATEUR group by FACTURE_INC.andoc,FACTURE_INC.monthdoc,FACTURE_INC.CodifCreno,FACTURE_INC.ArticleFournisseur;

load

applymap('GPE_CLIENT_map',FACTURE_INC.GroupeClient) as GPE_Cli,

applymap('GPE_FOURNISSEUR_map',FACTURE_INC.GroupeFournisseur) as GPE_FRN,

applymap('mapf',FACTURE_INC.CodifCreno) as Libelle_creno

resident FACTURE_INDICATEUR ;

Not applicable
Author

sorry but that not work

thanks a lot