SWITCH() in initial value using context view not working as expected

I for the life of me cannot determine why this expression isn't working. It's being used to generate the location depending on which view you're in, but it for whatever reason is not reading the views and returning the default value each time. 

Very confused ๐Ÿ˜‚

SWITCH([Location], IN(CONTEXT("View"), LIST("Enter Tips K")), "K", IN(CONTEXT("View"), LIST("Enter Tips G")), "G", " ")

0 5 158
5 REPLIES 5

is it that the expression isn't run in the context of a view so it would be unable to detect one? if that's the case, how would I be able to have the form auto-compute column [Location] depending on which view you selected. (different form view for each location). I currently have it set to initial value from the table itself (not sure how else to achieve this).

please help ๐Ÿ˜‚๐Ÿ˜ญ

I don't see anything wrong with the expression.  Make sure you are using the actual View names and NOT the Display names.


@kgrapevinetx wrote:

I currently have it set to initial value


Is this a new row or an existing row?  Be aware that "Initial Value" is only executed for NEW rows ...OR... if "Reset on edit" property is true on an existing row. 

While this won't fix your issue, you can simplify the expression like this:

SWITCH([Location], 
CONTEXT("View") = "Enter Tips K", "K",
CONTEXT("View") = "Enter Tips G", "G",
" "
)

 

I have copied and pasted the exact view names, and it is a new row. A form view for a new row. 

I don't see an issue with it either like ?? ๐Ÿ˜…


 

bump

 

Top Labels in this Space