Table "Are Updates Allowed?" formula

I want to control who can update row in a Table called TimesheetCompleted via a โ€œAre Updates Allowed?โ€ formula. Heres the formula Iโ€™m using:

IFS(
IN(โ€œManagerโ€,ANY(Select(Staff[Type],[Login Email]=UserEmail()))),โ€œADDS_AND_UPDATESโ€,
IN(โ€œAdminโ€,ANY(Select(Staff[Type],[Login Email]=UserEmail()))),โ€œADDS_AND_UPDATESโ€,
AND(
OR(
IN(โ€œSubcontractorโ€,ANY(Select(Staff[Type],[Login Email]=UserEmail()))),
IN(โ€œApprenticeโ€,ANY(Select(Staff[Type],[Login Email]=UserEmail()))),
IN(โ€œEmployeeโ€,ANY(Select(Staff[Type],[Login Email]=UserEmail())))
),
[TimeSheet].[TimesheetUser]=UserEmail()
),โ€œADDS_AND_UPDATESโ€
,
AND(
OR(
IN(โ€œSubcontractorโ€,ANY(Select(Staff[Type],[Login Email]=UserEmail()))),
IN(โ€œApprenticeโ€,ANY(Select(Staff[Type],[Login Email]=UserEmail()))),
IN(โ€œEmployeeโ€,ANY(Select(Staff[Type],[Login Email]=UserEmail())))
),
[TimeSheet].[TimesheetUser]<>UserEmail()
),โ€œADDS_ONLYโ€
)

So admins & managers have full access. Employees, Aprentices & SubContractors can add but only edit their records. Timesheet is the parent table. Formula checks out fine when I enter it, but fails after Save & Verify with โ€œcannot find column Timesheetโ€. Is this not possible? Iโ€™m guessing the issue maybe you arenโ€™t allowed to reference data in the same or parent table? I know I can do this be controlling each column in the table, or with a sliceโ€ฆ

Any ideas

0 5 908
5 REPLIES 5

Steve
Platinum 4
Platinum 4

The Are updates allowed? expression is not evaluated against each row; itโ€™s table-wide. Your attempt to access โ€œthis rowโ€™sโ€ column value (e.g., [Timesheet]) is therefore invalid. This is in contrast to a security filterโ€™s expression, which is evaluated against each row separately.

To do what it appears youโ€™re trying to do, youโ€™ll probably want to use the Only if this condition is true expression of the Edit system-generated action for the table, or something along those lines. Alternatively, create two separate slices, one for managers and admins that include all rows and allows adds and updates, and one for the current staffer that includes only their own rows and also allows both adds and updates, then make only the appropriate slice visible to the user.

Hi @Steve

What Iโ€™m to do is to control the โ€œAre Updates Allowed?โ€ using a TRUE or FALSE calcuation of data from a totally seperate table. I already appreciate you canโ€™t do this on the same table. Is this a something Appsheet has hard-coded in that we cannot do?

IFS(
  IN(...),โ€œADDS_AND_UPDATESโ€,
  IN(...),โ€œADDS_AND_UPDATESโ€,
  AND(
    OR(
      IN(...),
      IN(...),
      IN(...)
    ),
    [TimeSheet].[TimesheetUser]=UserEmail()
  ),โ€œADDS_AND_UPDATESโ€
  ...

In the above, what row contains the TimeSheet column youโ€™re dereferencing with [TimeSheet].[TimesheetUser]?

Hi Simon,

Did you ever find an answer to this issue?

Thanks!

I think I gave up on it and did it another wayโ€ฆ But its so long ago I canโ€™t remember. Feel free to post here your issue and iโ€™ll try and help

Top Labels in this Space