Ahoy,
I’ve just started using AppSheet and I’m really liking it so far. I’ve just started dabbling in the security filters for the permissions of the users (based on roles) in my app and I’ve hit a problem that is stopping my intended design.
The function context(“Table”) is dynamically switching context within the formula of my Security filter.
I have a table called let’s say “IT Help Desk”.
If I set a crude security filter up on the table such as:
CONTEXT(“Table”) = “IT Help Desk”
It will return all records because the table is “IT Help Desk”. Nice.
However, if I modify the security filter to have a test formula of:
ISNOTBLANK(
FILTER(
"Alternative Table",
CONTEXT(“Table”) = “IT Help Desk”
)
)
There will be no records returned, but we already saw previously CONTEXT(“Table”) = “IT Help Desk”, so if "Alternative Table" has records (which it does), then all records from that table should be returned and therefore not blank and all records of the “IT Help Desk” are shown based on an overall True.
But instead the same line CONTEXT(“Table”) = “IT Help Desk” is no longer True.
Regardless of where in the formula CONTEXT(“Table”) is called the table should remain the same as per the help file (which doesn’t say, “as per the table being read by the formula at that point in time”). Also, why would I want to know/retrieve that when I’ve just explicitly had to reference the table name in the formula.
- “Table - Name of the table used by the current view.”
If I do this instead (match the context table to the filter table being read):
ISNOTBLANK(
FILTER(
"Alternative Table",
CONTEXT(“Table”) = “Alternative Table”
)
)
Then CONTEXT(“Table”) = “Alternative Table” is True and all records in “IT Help Desk” are returned.
But without the preceding filter read, CONTEXT(“Table”) = “Alternative Table” is false.
I would think that this is bug along the lines of not saving the index location of the read prior to the table read within the filter and that being referenced at all time for CONTEXT(“Table”).
Love some help with this to unblock me. At this stage I’m looking to probably add a field to every table to record CONTEXT(“Table”) and then refer to that field in the Security Filter, which appears to work.
The other thing I have not yet tried and won’t apply to me (as I want a copy and past formula to apply to every table) is within the filters conditional statement is instead of directly reading the CONTEXT(“Table”), re-read the table I’m already on (to change the pointer, then doing the CONTEXT(“Table”) read at that point). But I don’t want to specify the table name in the formula otherwise I may as well write it as text instead of re-reading it, which makes CONTEXT(“Table”) redundant.
Cheers,
Mitch














