How to dynamically change a displayed value, based on CONTEXT("Host")

I have a column which returns a group_name (eg "5th Portsmouth", "33rd Portsmouth" etc).  This is displayed in a UX table.

When displayed on a phone or tablet [CONTEXT("Host") = "Device] I want to display a short version of the name 5th, 33rd etc to maximise use of the screen 'real-estate'.

I have tried a number of solutions, without luck, including:

  • defining 2 views and having the UX display only the relevant one based on the Context.  This worked but was complex and hard to maintain, over time.
  • Apply "Show if?" constraints to the displayed table.  This worked, to a point.  Values were hidden as expected, but (as detailed elsewhere here) the Column itself - and it's heading - remained but with blank values.
  • Creating a new virtual column with IF conditions to control the value saved, based on the CONTEXT.

 

IF(
  CONTEXT("Host") = "Device" , 
  LEFT([v_1st_nearest].[L_group_name], (FIND(" ", [v_1st_nearest].[L_group_name]) - 1)),
  [v_1st_nearest].[L_group_name]
 )โ€‹

This does not work, I assume because the virtual column is calculated without access to the CONTEXT, so always defaults to the IF THEN FALSE condition (the full length name).

 

How else can I approach this, or is it a case of living with the complexity of having two views to maintain in line with one another?

Thanks in advance.

Guy

0 2 93
2 REPLIES 2

Hi there, not sure about the virtual column, but I do tried before, a dynamic column display name which depending on CONTEXT, you may refer to the video below:

https://www.youtube.com/watch?v=sOqnwEj2VuI

 

You can have an action button, linked to a parameter in the user table, and let the user toggle between full and abbreviated values. A virtual column, this is the one to display in the table, would calculate the values based on the user's choice. 

Note: Virtual columns do have access to the different CONTEXT() options, but the "Host" option will return "Server".

Top Labels in this Space