5 Replies Latest reply: May 13, 2014 3:24 AM by Martin Mahler

Variable as a Field in Table

Hi everybody,

i have a table like this:

LineNr

myVar

1Sum( {<Tbl1.Field_1={"10"}>} Value )
2Sum( {<Tbl1.Field_1={"75"}>} Value )
3Sum( {<Tbl1.Field_1={"130"}>} Value )

now i need to have a Table Diagramm and calculate the value of field "myVar" in my table as a cilumn.

I have tried expressions like \$(myVar) , \$(\$(myVar)) , \$(\$(=Only(myVar)) , ..... but none of them calculate the experssion!

Anybody has an idea?

Many Thanks - Peyman

• Re: Variable as a Field in Table

What is the dimension? If your table is a data island, chances are that when you use myVar in a chart (table diagram) a Cartesian product is created: Every field will associate with every variable/formula. This means that the expression has no idea which field in myVar to evaluate thus returning null.

If you are trying to create a table with KPI, try working with ValueList() or ValueLoop() instead.

• Re: Variable as a Field in Table

Hi Martin,

the LineNr is my Dim. and i have considerd the point you hav mentioned in my set analysis.

My Problem is to calculate the content of a filed as an experssion in my table diagramm.

Best Regards - Peyman

• Re: Re: Variable as a Field in Table

This should work as an expression:

Pick(Match(myVar,\$(=Chr(39)& Concat(myVar, Chr(39)&','&Chr(39),LineNr) & Chr(39))),\$(=Concat(myVar,',',LineNr)))

• Re: Variable as a Field in Table

Hi Martin,

it's really berliant! I have to test this tomorrow.

I think that this will work.

the only problem is performace, becuse my table is relativ big and vars are long. I'm not sure how long can be the strings in QV.

Best Regards - Peyman

• Re: Variable as a Field in Table

I think performance should be fine because the concat() function is calculated only once for the table. All that ofc as long as your expressions are straightforward themselves.