Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Not applicable

column() by name not number?

I thought this would be easy to find via search, but no dice. I have a straight table/chart that uses column() references in its expressions -- e.g. Cost * column(1). I want to refer to columns not by number but by name (label). Further, many of my column names use expressions. So I might have a column label set to...

="Usage" & chr(10) & vMonth

Part of the problem is users clicking and dragging column headers around to reorder the columns (sometimes inadvertently). This throws off some of the calculations. Rewriting the expressions to not use column references isn't really an option.

Is there a way? Thanks.

1 Solution

Accepted Solutions
Highlighted
sbobbyraj
Contributor III

Re: column() by name not number?

Hi,

Try this in your expression :

$(='['&"Usage" & chr(10) & vMonth&']')

5 Replies

Re: column() by name not number?

The changing nature (because you use expressions for column label it seems) of the column label might make it difficult, if not impossible, to refer the label names in your expression. May be use the actual expressions or put the expression in a variable and use variable to do what you are doing with the expression labels.

MVP
MVP

Re: column() by name not number?

Try

="$(='Usage' & chr(10) & vMonth)"

luciancotea
Valued Contributor

Re: column() by name not number?

One solution is to block the columns rearranging:

Straigt Table -> Presentation -> Allow Drag and Drop

Pivot -> Presentation -> Allow Pivoting

But usually I write expressions without referencing other columns.

Highlighted
sbobbyraj
Contributor III

Re: column() by name not number?

Hi,

Try this in your expression :

$(='['&"Usage" & chr(10) & vMonth&']')

Not applicable

Re: column() by name not number?

Excellent. Thank you.