Security filter formula

Hi,
How do I make a formula in a security filter so only the rows with the location where the useremail is equal to the value in [name] are visible.
Please provide formula, all I tried did not work.

|key| company| location | name | crop nr| local staff|

|1 | 1 | a | he@gmail.com | 1 | joe |
|2 | 2 | b | he@gmail.com | 2 | leo |
|3 | 3 | c | not he@gmail.com | 3 | steff |

Michel.

Solved Solved
0 10 280
1 ACCEPTED SOLUTION

this works:

IN([Company], SELECT(company[company], [name] = USEREMAIL()))

View solution in original post

10 REPLIES 10

Hi,

Take a look at the security table โ€œlocationsโ€ in the following public app:

https://www.appsheet.com/samples/Built-from-your-app-spec-?appGuidString=94ae3b75-b962-45c6-b2c0-33b...

Itโ€™s a simple pattern which matches against the currently-logged-in email address. You will want to use the โ€œpreview asโ€ feature to test one the following emails:

person1@example.com
person2@example.com
person3@example.com
person4@example.com
person5@example.com

Is this the question you were asking?

Did you tried

[name]=useremail()

?

I tried in , or , select , list, in lot of combinations.

The useremail he@gmail.com must be able to see all rows containing company 1 and 2.
useremail nothe@gmail.com can only see rows containing company 3.

how to set up a formula for that?

i would use slices whit what i want each slice to show.

and then i would use in the UX, the option โ€œshow ifโ€ with these formulas. depending on the slice

useremail() = โ€œhe@gmail.comโ€
useremail() = โ€œnothe@gmail.comโ€

now this is a basic workaround there is a better way but this is how i make it work.

What happens when you use that formula in security filter?

I have a sheet with a data tabel, data about wich company is connected to wich useremails.

When a filter with email adresses is usedlike you suggest, then with every change in company or useremail the formula has to be adjusted with the new useremail.

I have read help pages, they suggest to use security filter to filter rowdata, much safer and much faster in downloading data from cloud to the device.
But wich formula to use in the security filter to filter allow username belonging to the companies ?

[Name]=USEREMAIL() should work.

Use this formula just as we wrote it, with nothing in the brackets () , and change nothing else. The formula gets the email that is used to be loged in on every device.

You donโ€™t have to write email adresses.

So on my phone , formula with get my email , on your it will get your email.

yes when the username is equal to the name in the row it works like you suggest, useremail will only see useremail rowsโ€ฆ

But in my case the company is leading looking from other tables to the example table.

So when a user is logged in, then this user will of all tables see rows of companies only when in the example tabel the company is on the same row as the useremail() in column [name].

So the security filter formula has to look in the example table in the column [useremail], to compare username() then compare with column [company] to compare company, result of security filter in all other tables must be all rows of column company were [username] equals username() in the example tabel.

I tried this now in the security filter:
and ( IN([company], LIST(company[company])) , IN(useremail(), LIST(company[name])))

does not work, all is filtered out nothing shown.

this works:

IN([Company], SELECT(company[company], [name] = USEREMAIL()))

Top Labels in this Space