Format Rules - Filter based on Slice context possible?

I’m building a dashboard view for sorting TCM (transitional care management) patients. I currently have two views nested inside that are built on slices to help sort patients into different TCM categories. The two views are/slices are called “TCM Patients - Red” and “TCM Patients - Yellow”, with the dashboard viewing being called “TCM - DONOTUSE” for the time being…

I know that I can assign format rules based on CONTEXT(“VIew”) = “Insert View Name Here” but i am having a bit of trouble thinking outside the box at the moment. I want to color the [Full Name] column of the patient red if they are in the “TCM Patients - Red” slice, with similar formatting to follow as i add more color coded staged.

Does the CONTEXT() expression have the ability to target slices, and if so, what’s the proper syntax? I would like for the formatting to take place within the “TCM - DONOTUSE” view, but of course separated based on the slices. I am finding that filtering by CONTEXT(“View”) = “TCP Patients - Red” does not work, presumably because that is a view that is nested inside of TCM - DONOTUSE, and that parent view is what is exposed to AppSheet when looking at the dashboard.

A few ideas, i could just copy the expression i used to create the slices into the format rules, or i could create a “TCM Stage” column in the patient records and filter based on the view plus the tcm stage value.

Still, i’m curious about more elegant solutions, if there is a better way.

Within a dashboard view, CONTEXT(“View”) will always return the name of the dashboard, not the name of a view within the dashboard.

To my knowledge, there is no way to determine which slice an expression is being evaluated against.

2 Likes

Why not create a virtual column that determines the patient’s TCM stage, then cue both the slices and the format rules off that?

3 Likes

You could try the CONTEXT function’s Table option. See what it returns and maybe it could be leveraged to accomplish what you need.

Generally I think It’s not weird if a format rule has the same expression as a slice.

It makes supporting and developing the app more difficult. Better to avoid.

1 Like

Agree. But sometime It’s good to highlight rows on other views which is not based on some important slices especially deck view which has limit columns & spaces to display (let alone additional virtual columns). This’s where format rules using slice expression comes to play.

My gold rules is trying to avoid format rules & actions which are related to SELECT in any ways (either in their expressions directly or via any virtual columns) because it hurts app performance noticeably.

1 Like