Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
patrou38
Creator
Creator

Mise a jour variable

Bonjour,

je voulais savoir si il existe un moyen de stocker le resultat d'une expression sur un variable ?

merci de votre aide.

cordialement,

Patrick

10 Replies
Anonymous
Not applicable

Hey Patrick !

Au niveau du script tu peux stocker une valeur avec la fonction peek():

Exemples :

peek( 'Ventes' )
renvoie la valeur de Ventes de l'enregistrement précédent lu ( équivalant à previous(Ventes)).

peek( 'Ventes', 2 )
renvoie la valeur de Ventes du troisième enregistrement lu de la table interne active.

peek( 'Ventes', -2 )
renvoie la valeur de Ventes de l'avant-dernier enregistrement lu dans la table interne active.

peek( 'Ventes', 0, 'Tab1' )
renvoie la valeur de Ventes du premier enregistrement lu dans la table d'entrée étiquetée Tab1.

Load A, B, numsum( B, peek( 'Bsum' ) ) as Bsum...;
crée une accumulation de B dans Bsum.

Je reste à ta disposition

Jon.

sergio0592
Specialist III
Specialist III

Je comprends pas vraiment la question mais si on stocke l'expression dans une variable, le résultat de celle-ci est stocké dans la variable.

patrou38
Creator
Creator
Author

bonjour,

merci de la reponse.

je vais essayer d'etre plus précis sur ma demande.

j'ai un chart avec en dimension une periode (les 3 derniers jours).

j'ai un expression qui et un calcul et c'est se calcul que je veux stocker (sachant qu'il tient compte de ma dimension).

ci dessous mon expression.

=round(count({<Availability={'WIP'},[Product Type Code]={'DI'}, [Hold Status]={'HOLD'}, Division={$(choice2)}>} [Lot number]))/
round(count({<Availability={'WIP'},[Product Type Code]={'DI'}, Division={$(choice2)}>} [Lot number]))

Merci beaucoup de votre aide.

Cordialement

patrou38
Creator
Creator
Author

bonjour,

merci de la reponse.

je vais essayer d'etre plus précis sur ma demande.

j'ai un chart avec en dimension une periode (les 3 derniers jours).

j'ai un expression qui et un calcul et c'est se calcul que je veux stocker (sachant qu'il tient compte de ma dimension).

ci dessous mon expression.

=round(count({<Availability={'WIP'},[Product Type Code]={'DI'}, [Hold Status]={'HOLD'}, Division={$(choice2)}>} [Lot number]))/
round(count({<Availability={'WIP'},[Product Type Code]={'DI'}, Division={$(choice2)}>} [Lot number]))

je n'arrive pas a incorporer un SET dans cette expression 😞

Merci beaucoup de votre aide.

Cordialement

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Le problème se situe probablement dans la partie "$(choice2)" par la double expansion.

Dans votre script, essayez le suivant:

LET vExpression = '=round(count({<Availability={''WIP''},[Product Type Code]={''DI''},' &

                  ' [Hold Status]={''HOLD''}, Division={$' & '(choice2)}>} [Lot number]))/' &

                  'round(count({<Availability={''WIP''},[Product Type Code]={''DI''},' &

                  ' Division={$' & '(choice2)}>} [Lot number]))';

Better switch to English, to make this useful thread accessible for everone. If you prefer posting in French, there is a French-language group as well here: Groupe des Utilisateurs Francophones

Peter

Anonymous
Not applicable

Effectivement ton expression si tu arrives à l'implémenter dans ton script tu pourras stocker ta valeur avec la fonction Peek().

Regards

patrou38
Creator
Creator
Author

Sorry, but LET is not recognize as a function in this expression....

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Sorry, I may have misunderstood your request.

I suggested a solution for storing the expression itself in a variable. That assignment should be done in your script (which is why I mentioned trying the LET statement in your script)

After that assignment, you can use the same expression anywhere you want by simply specifying $(vExpression) in an expression field.

However, since a variable is an internal object of type Dual and not a field, you cannot simply store multiple result values in a variable. Especially not when the expression is used in a Chart object where one or more dimension values will influence the outcome of the expression on each individual object row.

You can however easily reuse the expression in another context using the technique I suggested before.

Peter

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Did you try creating a new variable in the Settings->Variable Overview window and entering the following in the expression field?

=round(count({<Availability={'WIP'},[Product Type Code]={'DI'}, [Hold Status]={'HOLD'}, Division={$(choice2)}>} [Lot number]))/

round(count({<Availability={'WIP'},[Product Type Code]={'DI'}, Division={$(choice2)}>} [Lot number]));


Everywhere you use this variable, the QlikView engine will re-evaluate the stored expression and produce a single value that will be used in the context where you specify that variable.

Even if this doesn't really lead to a particular value being stored in the actual variable (that would wipe out the expression, wouldn't it), it results in every occurrence of your variable being replaced with the result of your expression.