Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Author

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!

View solution in original post

6 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

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

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
disqr_rm
Partner - Specialist III
Partner - Specialist III

Hi Dario,

Were you able to get this one solved?

Anyone has any idea?

Thanks

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

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

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
nagaiank
Specialist III
Specialist III

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

Not applicable
Author

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
Author

Hello

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

Many thanks.