Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
patrou38
Creator
Creator

Set analysis in Variable

Hello,

I tried to put an expression in variable without success.

the expression is :

=if(

GetSelectedCount([Plant]) = 0,

aggr(only({<[Plant]= P([Plant]), [Product Type Code]= {'DI'}>} [Plant]), [Plant]),

aggr(only({<[Plant]= P([Plant]), [Plant]= {'*'}, [Product Type Code]= {'DI'}>} [Plant]), [Plant])

)

is it possible for you ?

thank you for your support.

Regards,

Patrick

6 Replies
patrou38
Creator
Creator
Author

I forgot to say that this variable will be used in a lis box.

marinadorcassio1
Partner - Creator
Partner - Creator

Où se situe le problème exactement ? Cela ne retourne rien, ou Qlik te signale une erreur de syntaxe ?

patrou38
Creator
Creator
Author

cela ne retourne rien... 😞

marinadorcassio1
Partner - Creator
Partner - Creator

Je n'ai jamais utilisé P() et E(), mais es-tu sur que cela s'utilise de cette façon ?

Si ça ne retourne rien à mon avis il faut y aller pas à pas :

commence par afficher juste un bout, aggr(only({<[Product Type Code]= {'DI'}>} [Plant]), [Plant]) par exemple, puis rajoute au fur et à mesure, tu auras plus de facilier à voir d'où vient le problème

patrou38
Creator
Creator
Author

tu as raison.

si je mets =aggr(only({<[Product Type Code]= {'DI'}>} [Plant]), [Plant]) dans un list box cela fonctionne, mais mon objectif est de mettre cette expression en variable et apres mettre =$(MaVar) dans une liste box.

l'objectif a term est de mettre un maximun d'expression avec des if et autre en variable pour eviter les calcul lors du chargelent de la page .

merci de ton aide et conseil.

cordialement,

Patrick

marinadorcassio1
Partner - Creator
Partner - Creator

Ce n'est pas un problème, tant que ta variable retourne quelque chose

Si tu définis bien ta variable, tu peux l'utiliser ensuite sans souci à priori.

J'ai personnellement un peu de mal à comprendre en quoi cette variable dans un list box va faire gagner du temps, au contraire même j'aurai dit, mais je ne suis pas experte

Bonne continuation !

Marina