Would it be possible for AppSheet to add a WITH() function, similar in concept to the WITH clause available in SQL queries ?
Syntax
WITH(constant-name1, constant-value1, [constant-name2, constant-value2...], result)
How it works
Benefits
Example
A table security filter expression returns TRUE for the rows of table employee that should be loaded in a HR App, where the user works on a subset of employees at a time. The filter condition is :
Example Original Expression
OR(
[employee_Email] = USEREMAIL(),
[employee_department_Code] =
ANY(SELECT(parameter[parameter_DeptUpdate], [parameter_User] = USEREMAIL())),
IN(
[employee_id],
SELECT(
history[history_employee_Id],
[history_DeptCode]
=
ANY(SELECT(parameter[parameter_DeptUpdate], [parameter_User] = USEREMAIL())))))
Example Expression rewritten using WITH
WITH(
"user_department_to_update",
ANY(SELECT(parameter[parameter_DeptUpdate], [parameter_User] = USEREMAIL())),
"employee_ids_previously_same_department",
SELECT(
history[history_employee_Id],
[history_DeptCode] = [_CONST.user_department_to_update]),
OR(
[employee_Email] = USEREMAIL(),
[employee_department_Code] = [_CONST.user_department_to_update],
IN([employee_Id], [_CONST.employee_ids_previously_same_department])))