Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Skip the ticket, Chat with Qlik Support instead for instant assistance.
cancel
Showing results for 
Search instead for 
Did you mean: 
derekjones
Creator III
Creator III

Parameterised Variable but in an Expression table

Hi All

I'm trying to use the amazing functionality of a parametrised varaible e.g. var=sum($1+$2) so var(a,b)=sum(a+b) but I'm trying to go one stage further and use this functionaity in expressions from a table, so I can store multiple expressions based on dimension choice but on a parameterised basis as what you can do in variables.

If it helps, I've included a simple app with a step by step attempt.

So I've got a data table with two rows of data with the value fields (a, b and c)

I currently have two calculation functions (but I want many in reality, hence why want to store in table rather than individual variables). So I've created two parameterised variables:

vAddFunc=sum($1+$2)

vMultiFunc= sum($1*$2)

In example 1, I can call each function in the table expression and use any of the data columns (so I'm using a and b in my example).

Switching %Field from Add to Multiply chooses each function. However each is it's own variable and requires either conditional expressions in table to pick correct variable or I would need an if statement. So this is not scalable in what I'm looking to do e.g. add many other functions using same parameters e.g. Divide, Double, Subtract etc

So, I look to another neat solution which is to store the expressions in a table that the expression can be recalled by reading that table. So example 2 in the middle shows this 'without' the parametrised variables i.e. fixed expressions for a and b. Here, as you select %Field it determines which expression to use.

So to my final example, I am now trying to merge the two i.e. recall and expression from a table but utilise the parameter functionality of a variable. So I've tried mashing both together (using a variable to recall the table expression which has $ parameters) but I can get it to work 😞 .

Is this just not possible or have a missed out something in my expression definition?

My thanks in advance for any genius suggestions

Derek

 

 

 

 

 

 

1 Solution

Accepted Solutions
derekjones
Creator III
Creator III
Author

I solved it myself, working Example 3 attached for anyone that has the same issue or would like to use this functionality. 

View solution in original post

1 Reply
derekjones
Creator III
Creator III
Author

I solved it myself, working Example 3 attached for anyone that has the same issue or would like to use this functionality.