Are Updates Allowed? rule not working

I’m using the following as an Are Updates Allowed? rule:

IF(
	OR(
		IN("Manager",INDEX(CURRENT_User[Type],1)),
		IN("Admin",INDEX(CURRENT_User[Type],1))
	),"ADDS_AND_UPDATES",
IF(
	ISBLANK(UserEmail()),"ALL_CHANGES",
	"READ_ONLY"
))

but when I try to edit a record I get:

Table 'Plot' does not allow this operation. Expression result: 
'READ_ONLY'. 
Expression Trace: 
{"key": "IF(OR(IN(\"Manager\",INDEX(CURRENT_User[Type],1)), IN(\"Admin\",INDEX(CURRENT_User[Type],1))),\"ADDS_AND_UPDATES\",IF(ISBLANK(USEREMAIL()),\"ALL_CHANGES\",\"READ_ONLY\"))","result": "READ_ONLY","values": []}

CURRENT_User is simply a slice to not have to use ANY(Select(… multiple times

I’ve tested the formula in UserSettings and as a whole I get a result of “ADDS_AND_UPDATES” and INDEX(CURRENT_User[Type],1)) gives me “Admin”.

So I’m a bit stuck as to how its clearly getting “READ_ONLY” at the table level :confused:

image

I’m surprised it’s not returning an error. The second argument of IN() should be a List, INDEX returns a single value.

2 Likes

Is [Type] EnumList?

If [TYPE] is Enum

IFS(
  INDEX(CURRENT_USER[TYPE], 1) = "Manager", "ADDS_AND_UPDATES",
  INDEX(CURRENT_USER[TYPE], 1) = "Admin", "ADDS_AND_UPDATES",
  ISBLANK(USEREMAIL()), "ALL_CHANGES",
  0=0, "READ_ONLY"
)

If [TYPE] is EnumList

IFS(
  IN("Manager", SPLIT(CURRENT_USER[TYPE], " , "), "ADDS_AND_UPDATES",
  IN("Admin", SPLIT(CURRENT_USER[TYPE], " , "), "ADDS_AND_UPDATES",
  ISBLANK(USEREMAIL()), "ALL_CHANGES",
  0=0, "READ_ONLY"
)

Yeah, sorry [Type] is a ENUMLIST

Though you maybe onto something. For my record it only returns “Admin”. I’ll see what happens if there is more than 1 item in [Type]

Nope doesn’t work if [Type]=“Admin,Manager”

I’ll try @SkrOYC suggestion

Check your EnumList config so that the Item Separator is configured as default
" , " (space - comma - space) to prevent problems in the future

Item seperator was missing. Added comma. Made no difference.

IFS(
  IN("Manager", SPLIT(CURRENT_USER[TYPE], " , ")), "ADDS_AND_UPDATES",
  IN("Admin", SPLIT(CURRENT_USER[TYPE], " , ")), "ADDS_AND_UPDATES",
  ISBLANK(USEREMAIL()), "ALL_CHANGES",
  0=0, "READ_ONLY"
)

No edit button

  IN("Manager", SPLIT(INDEX(CURRENT_USER[TYPE],1),",")), "ADDS_AND_UPDATES",
  IN("Admin", SPLIT(INDEX(CURRENT_USER[TYPE],1),",")), "ADDS_AND_UPDATES",
  ISBLANK(USEREMAIL()), "ALL_CHANGES",
  0=0, "READ_ONLY"
)

Same error message

  IN("Manager", LIST(INDEX(CURRENT_USER[TYPE],1))),"ADDS_AND_UPDATES",
  IN("Admin", LIST(INDEX(CURRENT_USER[TYPE],1))),"ADDS_AND_UPDATES",
  ISBLANK(USEREMAIL()),"ALL_CHANGES",
  0=0, "READ_ONLY"
)

No edit button

Odd thing is, why if I can see the edit button, I can’t edit a record. When the rule is supposed to apply to the entire table?

Make sure item separator is exactly Space - Comma - Space
Also the values on Type column inside the database should be this way:
Admin , Manager
Instead of
Admin, Manager or Admin,Manager
Just make sure the item separador is the string between the first and the second option

Well, if you’re just going to use SPLIT(), maybe not.

1 Like

Then

IFS(
  IN("Manager", SPLIT(CONCATENATE(CURRENT_USER[TYPE]), " , "),
    "ADDS_AND_UPDATES",
  IN("Admin", SPLIT(CONCATENATE(CURRENT_USER[TYPE]), " , "),
    "ADDS_AND_UPDATES",
  ISBLANK(USEREMAIL()),
    "ALL_CHANGES",
  0=0,
    "READ_ONLY"
)

:man_shrugging:t2:

1 Like

@1minManager
I suspect this is related to this kind of situation :nerd_face:

2 Likes
IFS(
  IN("Manager", SPLIT(CURRENT_USER[TYPE], " , ")), "ADDS_AND_UPDATES",
  IN("Admin", SPLIT(CURRENT_USER[TYPE], " , ")), "ADDS_AND_UPDATES",
  ISBLANK(USEREMAIL()), "ALL_CHANGES",
  0=0, "READ_ONLY"
)

No Edit Button

IFS(
  IN("Manager", SPLIT(INDEX(CURRENT_USER[TYPE],1)," , ")), "ADDS_AND_UPDATES",
  IN("Admin", SPLIT(INDEX(CURRENT_USER[TYPE],1)," , ")), "ADDS_AND_UPDATES",
  ISBLANK(USEREMAIL()), "ALL_CHANGES",
  0=0, "READ_ONLY"
)

No Edit Button

Tested IN(“Admin”, SPLIT(INDEX(CURRENT_USER[TYPE],1),",")) as a UserSettings formula. Result was TRUE

1 Like

CONCATENATE() should help

3 Likes
IFS(
  IN("Manager", SPLIT(CONCATENATE(CURRENT_USER[TYPE]), " , ")), "ADDS_AND_UPDATES",
  IN("Admin", SPLIT(CONCATENATE(CURRENT_USER[TYPE]), " , ")), "ADDS_AND_UPDATES",
  ISBLANK(USEREMAIL()), "ALL_CHANGES",
  0=0, "READ_ONLY"
)

Works. Totally not intuitive. But it works. Thanks @SkrOYC

Also love the

0=0, "READ_ONLY"

to give an IFS() a default condition. Definately be nicking that one :slight_smile:

3 Likes

@1minManager

Why not just use IF()???


I’m weary of the 0=0 statement - which is always true.

  • What happens if things don’t process linearly like we’re expecting?
1 Like

They invented Bug Reports for that
:joy:

3 Likes

@MultiTech_Visions I’m thinking more of a solution where you’ve got a formula with 5-10 nested IF()'s. Using an ISF() with this last row just looks neater. Appreciate its not more functional

1 Like