Setting default value for a field based on the view selected

I have an app set up where the main table is ‘administrative data’ with general fields. when collecting data the individual can select one o five different views based on what is being recorded. however, not every field in the table is needed for every view so I created slices for each view.

as it stands I have an enum field “Form Type” with data validation so I can have dependent drop downs for certain fields in the specific field.

this works but the user has to select the view then choose from the “Form Type” Field the same view. I was looking at LinktoForms() using the following:

Linktoforms(“CC Notes”, “FormType”, “CC Notes”) as the initial value for the FormType filed, but it returns a web address. Any suggestions?

It sounds that you could explore the CONTEXT(“View”) functions in the initial value of multiple columns based on the form view name.

Something like below:

SWITCH(CONTEXT(“View”), “Form_1”, “Default_Value_1”,

“Form_3”, “Default_Value_3”,

“Form_5”, “Default_Value_5”,

“Some Other Vlaue”

)

For this also you could explore using CONTEXT(“View”) function in show_if of different columns. But slice will also do as you have already done.

CONTEXT() - AppSheet Help