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
Solved! Go to Solution.
CONCATENATE()
should help
Iโm surprised itโs not returning an error. The second argument of IN() should be a List, INDEX returns a single value.
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.
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.
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"
)
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
CONCATENATE()
should help
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
They invented Bug Reports for that
@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
Thatโs the magic of CONCATENATE()
It solves all the mess that we could have made inside Item Separator and help SPLIT()
make itโs job
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?
@1minManager
I suspect this is related to this kind of situation
Would
IFS(
...
TRUE, "READ_ONLY"
)
not work just as well?
Yep, it should.
I do logic (0=0, 1=1 | 0<>0, 1<>1) because my main language is Spanish and the True, Verdadero, Yes, Sรญ, is a little bit messy.
Logic stuff is better from my POV since the platform decides how the hell it wants to save the value in the database while I get the results.
For example, I use โTrueโ as Initial Value and the platform saves that as โVerdaderoโ. Itโs counterintuitive. I preffer logic in this case
User | Count |
---|---|
43 | |
26 | |
24 | |
14 | |
12 |