Context View

I need that the dependent tables only allow to add or edit from the edition of the parent table, so that the updated calculations are saved. To do this I did the following:

IF(
CONTEXT(“ViewType”)=“Form”,

IFS(
LOOKUP(USEREMAIL(),“Usuarios”,“email usuario”,“Cargo”)=“Administrador”,“ALL_CHANGES”, LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cambiar Contraseña”)=“Salir”, “READ_ONLY”,
LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cargo”)=“Administrador”,“ALL_CHANGES”,
LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cargo”)=“Encargada”,“ADDS_ONLY”,
LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cargo”)=“Encargado”,“ADDS_ONLY”,
LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cargo”)=“Auxiliar”,“READ_ONLY”
),
“READ_ONLY”,
)

The IFS () expression was already working correctly, when I added the IF (CONTEXT (… something strange happens, it correctly displays the list online, with the VIEW button in the non-Form views and shows New in the Form.
Therefore I understand that you are interpreting the expression.
But when you click on NEW, the screen is empty

Video:

There are times where CONTEXT() might return a blank value. When that happens, CONTEXT(“ViewType”)=“Form” will be TRUE, which probably isn’t what you want. Change instead to “Form”=CONTEXT(“ViewType”).

Your IFS() expression lacks a default condition. If none of the existing conditions match, IFS() will return a blank value, which probably isn’t what you want. Add a default to IFS(): IFS(..., TRUE, "READ_ONLY").

You could easily handle the CONTEXT() check within the IFS() without an IF() wrapper: IFS(“Form”=CONTEXT(“ViewType”), "READ_ONLY", ...).

See if these suggestions help.

1 Like

@Steve

I modified the expression like this, but it produces the same effect

IFS(
“Form”<>CONTEXT(“ViewType”), “READ_ONLY”,
LOOKUP(USEREMAIL(),“Usuarios”,“email usuario”,“Cargo”)=“Administrador”,“ALL_CHANGES”, LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cambiar Contraseña”)=“Salir”, “READ_ONLY”,
LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cargo”)=“Administrador”,“ALL_CHANGES”,
LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cargo”)=“Encargada”,“ADDS_ONLY”,
LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cargo”)=“Encargado”,“ADDS_ONLY”,
LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cargo”)=“Auxiliar”,“READ_ONLY”
)

I don’t know how to put a default value in the IFS () expression, since it asks me for pairs of values:

“IFS function is used incorrectly:Inputs to IFS() must be one or more condition-value pairs.”

Could you see the video?

This should show at the end

Keep in mind that the expression seems to work correctly, because the VIEW AND NEW buttons appear correctly, if it is a form it allows you to add a new record, and if it is in another view it does not allow it. The only problem is that for some reason it lose the reference to the next view.
A similar problem I am having in another app

@Steve was giving you a suggested default condition like this

IFS(..., TRUE, "READ_ONLY")

Where ... was all of your other conditions together. In your latest post, taking your IFS() and adding the default line, it would look like this:

IFS(
“Form”<>CONTEXT(“ViewType”), “READ_ONLY”,
LOOKUP(USEREMAIL(),“Usuarios”,“email usuario”,“Cargo”)=“Administrador”,“ALL_CHANGES”, LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cambiar Contraseña”)=“Salir”, “READ_ONLY”,
LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cargo”)=“Administrador”,“ALL_CHANGES”,
LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cargo”)=“Encargada”,“ADDS_ONLY”,
LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cargo”)=“Encargado”,“ADDS_ONLY”,
LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cargo”)=“Auxiliar”,“READ_ONLY”,
TRUE, "READ_ONLY"
)

1 Like

@Steve
I made all the recommended modifications:
With this expression it does not work:

IFS(
CONTEXT(“ViewType”)<>“Form”,“READ_ONLY”,
LOOKUP(USEREMAIL(),“Usuarios”,“email usuario”,“Cargo”)=“Administrador”,“ALL_CHANGES”, LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cambiar Contraseña”)=“Salir”, “READ_ONLY”,
LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cargo”)=“Administrador”,“ALL_CHANGES”,
LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cargo”)=“Encargada”,“ADDS_ONLY”,
LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cargo”)=“Encargado”,“ADDS_ONLY”,
LOOKUP(MAXROW(“Ingreso”,"_ROWNUMBER",true),“Ingreso”,“Ingreso Id”,“Cargo”)=“Auxiliar”,“READ_ONLY”,
TRUE," READ_ONLY "
)

With this expression YES it works:

IF(CONTEXT(“ViewType”)=Form,
“ADDS_ONLY”,
“READ_ONLY”
)

I even just noticed that Form did not put quotes, and it works the same way.
I used the first expression again taking out the quotes and it doesn’t work either.
It is caused by the IFS () or too many conditions, but it does not seem to be a syntax problem.

Some explanation?

Account ID: 461773
App: Fun Zone San Juan
Table: Recibos
Are update allowed?

If your IFS() statement was copy/pasted, you’ll need to remove the spaces within the quotes of the copied portion above - change it to TRUE, “READ_ONLY”.

1 Like