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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
felcar2013
Partner - Creator III
Partner - Creator III

how to restrict a variable

Hi
sorry for this question, but i need help on this
i have a variable  "z_bestand", which was generated in the script. Now i need to create a variable using the User Interface (Variable List)
i want to restrict the "z-bestand" (total number of customers) to have only customers that bought something. (field: contact_activity = '1' = active, '0' = inactive). This is i want to take only the contact_activity = '1'. I tried with set analysis, but i cannot use an aggregation function because the "z-bestand" is already a stock variable (i.e., a total number). 
 
num ({$<contact_Activity={'1'}>}{$(z-bestand)}
is there other way to restrict the variable in the user interface variable list? is it possible to use if-statements in the variable list window?
if i restrict in the script, how shall i call the variable "z_bestand" restricting it to take only the "active customers". as it was also created in the last script tab, it may probably will not read the variable
many thanks
felipe
Labels (1)
1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You could just select 1 in the field contact_Activity.

If you want to change the z_bestand expression and only want to add contact_Activity={'1'} then change

     LET z_bestand='count({$<';

into

     LET z_bestand='count({$<contact_Activity={1},';

Selections in fields that don't begin with transaction_ are used for calculating the z_bestand expression, so you can restrict values in these fields by making selections in them.


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You could just select 1 in the field contact_Activity.

If you want to change the z_bestand expression and only want to add contact_Activity={'1'} then change

     LET z_bestand='count({$<';

into

     LET z_bestand='count({$<contact_Activity={1},';

Selections in fields that don't begin with transaction_ are used for calculating the z_bestand expression, so you can restrict values in these fields by making selections in them.


talk is cheap, supply exceeds demand
felcar2013
Partner - Creator III
Partner - Creator III
Author

thanks,

contact_Activity is a hidden field. I changed it to %contact_Activity_ID and set the Prefix '%', so that it does not appear in the final result of "z_bestand"

It is not possible to fix the z_bestand with " {$<contact_Activity={1}>}" in the formula.

do you know another way to manipulate the variable?

felipe

felcar2013
Partner - Creator III
Partner - Creator III
Author

your first recommendation worked well

thanks a lot

felipe

felcar2013
Partner - Creator III
Partner - Creator III
Author

sorry that i disturb you again, i have this concrete case for active members,  i also need to do the same for other cases, for ex. where gender= male or female or unknown or other or where i have to restrict to a condition.

what would you recommend here? lets assume  have to create 20 such cases (variables?)

thanks again!

felipe