Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

Evaluate field values as chart expressions

Hi there,

I've got a problem, I would like to change on-the-fly the expression on a chart.

I've already been able to do this by:

1) keep all the possible chart expressions in variables (1 variable = 1 chart expression)

2) in the chart create a big IF statement based on the value of the variable behind a dropdown box.

I wonder if I can (for example) create a data source (Excel or a SQL Table) containing all the expressions and evaluate them doing something like

Indicator  | Formula

Indicator A | ((sum({$<Anno={2009}>}[Nati - Totale]))/sum({$<Età={">=15<=50"}>}([Totale Femmine])))*1000 

- I've tried to insert the formulas into an INLINE statement with no success.

- I've tried to evaluate the formulas at loadtime with Evaluate() with no success

- I've tried to insert the following expression as chart formula

=$(FieldValue('Formula',FieldIndex('Indicatore',IndicatoreGrafico)))

but again, no success.

Any help woud be appreciated.

Thanks in Advance

Dario

1 Solution

Accepted Solutions
Not applicable

Evaluate field values as chart expressions

Hi all,

I've managed to solve the problem in the following way:

- First, I've created an Excel file containing all the expressions. The file was like this:

ExpressionName | ExpressionDefinition
Sales for Region One | Sum({$<Region={1}>}Sales)
.

.

.

- I've created a variable in my qvw sheet (vCurrExp)

- I've created a selector for ExpressionName an then associated an action "assign a variable" to that selector. The action was to assign the value ExpressionDefinition to the variable vCurrExp.

- Last, I've created a chart whose expression was simply $(vCurrExp), and that worked for me perfectly!

Thank you all!

6 Replies

Evaluate field values as chart expressions

Hi,

    I would suggest you to store your expression in varibales and use them in expression.

    Mean while i am working on your problem

Regards,

Kaushik Solanki

disqr_rm
Valued Contributor III

Evaluate field values as chart expressions

Hi Dario,

Were you able to get this one solved?

Anyone has any idea?

Thanks

Re: Evaluate field values as chart expressions

HI,

   One way to change the expression on fly is to group the expression.

   This way you can change the expression, but you need to select an expression whatever you want from the dropdown list.

   Have a look at the attched document.

Regards,

Kaushik Solanki

nagaiank
Valued Contributor III

Re: Evaluate field values as chart expressions

Attached is a simple example of doing this. Hope this helps to solve your problem

Not applicable

Evaluate field values as chart expressions

Hi all,

I've managed to solve the problem in the following way:

- First, I've created an Excel file containing all the expressions. The file was like this:

ExpressionName | ExpressionDefinition
Sales for Region One | Sum({$<Region={1}>}Sales)
.

.

.

- I've created a variable in my qvw sheet (vCurrExp)

- I've created a selector for ExpressionName an then associated an action "assign a variable" to that selector. The action was to assign the value ExpressionDefinition to the variable vCurrExp.

- Last, I've created a chart whose expression was simply $(vCurrExp), and that worked for me perfectly!

Thank you all!

Not applicable

Evaluate field values as chart expressions

Hello

Do you have an example QVW that shows how this works?

Many thanks.

Community Browser