Got a bit of strange behaviour. I'm trying t...

ux
(Simon Robinson) #1

Got a bit of strange behaviour.

I’m trying to get it so that

Any(Select(Users[Type],[Users]=UserEmail()))=”Employee”

can only add items to a sub-table, whereas

Any(Select(Users[Type],[Users]=UserEmail()))=”Management”

can add, edit and delete to the same table.

So to do this I have one table with 2 List Views, which both Ref the subtable.

The first points to the entire table, the second points to a slice.

This works fine.

I then thought I could use a

Show_If in the List/Ref of the main table to control which sub-table view you get to see.

The issue is that Appsheet seems to be totally ignoring the Show_If.

Whatever is in the Show_If, it always displays both.

I’ve even tried TRUE and FALSE.

Yet if I tick to hide them, it always hides them.

I’ve used this same technique before without issue.

Can anyone help or suggest a better way?

(Levent KULAÇOĞLU) #2

@Simon_Robinson why don’t you set an “access privileges” table in your app and then according to the privileges from this table, use a SWITCH statement in your table’s Are updates allowed? property expression right under the Table Name? You don’t need to set seperate views for each access level then. More prettier and more smarter way to accomplish. Like this:

SWITCH( USEREMAIL(),

"user1@mydomain.com", “UPDATES_ONLY”,

"user2@mydomain.com", “ALL_CHANGES”,

“READ_ONLY” )

The SWITCH expression have the syntax of:

SWITCH( {Your condition to be evaluated}, {Case1}, {Value If TRUE}, {Case2}, {Value If TRUE}, . . . {Default Value If all cases are FALSE} )

(Steven Coile) #3

FYI:

Any(Select(Users[Type],[Users]=UserEmail()))

can be expressed slightly more compactly as:

lookup(useremail(), users, users, type)

(Steven Coile) #4

@Levent_KULACOGLU’s suggestion is the correct course of action.

(Simon Robinson) #5

@Levent_KULACOGLU Thanks for your help.

Didn’t realise there was a formula you could set in there!