Does anyone know a workaround for using an expression such as IF(Context(“View”)=“xyz” in a virtual column formula, so that the virtual column will only load when looking at the view it is needed for? It would help my app a ton if certain virtual columns could just load when needed rather than on every sync.
There is a warning from appsheet that context view or viewtype may not work correctly if used on a VC. Just curious if anyone has found a workaround for the issue. I also tried IF(Context(“Table”) = “xyz”, but it didn’t seem to do anything.
Increasing the reference web density of your app, allowing for more complex and deeper chaining dereferences (this way you can use a chaining dereference formula to get your value, vs. building it inside a VC.
Instead of trying to base the formula on Context(“ViewType”):
Try basing it on a column.
Include a column that’s an enum with a single option, visible only inside the form, that’s only valid if the field is blank; this will create a “button” inside the form that your user can click, and you can use this for your condition for the heavy formula.
With the validation that the field be blank, a user can’t save with the toggle turned on - thus reserving the heavy formula for inside the form.
If you’re using Google Sheets or Excel:
Here’s some note parameters for the column:
AppSheet:{"IsRequired":false,"Type":"Enum","Default":"","TypeAuxData":"{\"EnumValues\":[\"Show Details\"],\"AllowOtherValues\":false,\"EnumInputMode\":\"Buttons\",\"Show_If\":\"CONTEXT(\\\"ViewType\\\")=\\\"Form\\\"\",\"Valid_If\":\"ISBLANK([_this])\",\"Error_Message_If_Invalid\":\"Please clear the button before saving.\"}","Description":" "}
Put that in the header of the column as a note before you regenerate your columns and you won’t have to do the configuration yourself.