Display name expression for different name depending on view type?

Hey all. I would love to have the column name be different depending on whether it’s a table view or detail view.

I’m using a dashboard for table view in an inventory app and I’d like the column name to just be narrow, OH QTY (short for on hand quantity) but for a detail view it would be nice to have the full name since there is more room. ON HAND QUANTITY.

Can anyone help w the expression here? Would it be an IF expression and then use CONTEXT somehow?

1 Like

Try this.

SWITCH(CONTEXT(“put here view name”),
“view1”,”col name 1”,
“view2”,”col name 2”,
“Default col name”)

1 Like

should instead be:

SWITCH(CONTEXT(“View”),
“view1”,”col name 1”,
“view2”,”col name 2”,
“Default col name”)

The argument to CONTEXT() should be the raw text value, View, not the name of the view.

See also:

1 Like

Great I figured that out @Steve thank you!

What I noticed is the column names do not show as either of the two custom names in a dashboard view but rather just the default. Is this normal behavior?

I was hoping to have a list view with a short name and detail view with a longer name in a dashboard :slight_smile:

I’m not sure you can do that–though it’s not something I’ve (recently?) tried, so I can’t say for sure.

I don’t believe it’s possible unless the following screens show you something that isn’t normal behavior in your understanding, or if theres some workaround.

This is a simple purchasing app. I used this expression which works only when the views are fullscreen (first two screenshots), not dashboard (as in the third screenshot)…

SWITCH(CONTEXT(“View”),
“VENDOR PRODUCT_Detail”,[ON HAND] &" / " & [UNIT],
“VENDOR PRODUCT LIST”,”ON HAND”,
“OH”)

Here are the screens which show the display name defaulting instead of using the first two, I guess because the dashboard doesn’t allow for CONTEXT to be applied?

full screen list view…


full screen detail view…

dashboard showing both…

1 Like

@Steve I just realized a pretty easy workaround is a virtual column displaying the value of the first column and using that on one view and the original on the other view.

Duh lol

1 Like