Trying to use a value from the Usersettings () within a slice row filter condition.
The data table has corresponding company reference [COMPANYLOG] and I thought it was as simple as:
[COMPANYLOG]=USERSETTINGS(Company)
I have checked I have values in the data table and Usersetting that match but not coming through - am doing this correct?
Try to use USERSETTINGS(โCompanyโ) if that would help.
Thanks You very much
In what way is it โnot coming throughโ? Some rows youโd expect to appear arenโt? None of the rows youโd expect appear? Rows you donโt expect do appear?
At the very least, because of the way the is-equal-to? operator (=) works in AppSheet, if the left-hand argument ([COMPANYLOG]
, in your case) is blank, the expression will be TRUE regardless what the right-hand argument (USERSETTINGS(Company)
) is. This might result in the occurrence of unexpected rows in your slice if [COMPANYLOG]
is ever blank.
Thanks - they were blank - no rows coming through. I think then discovered the usersettings werenโt getting updated and saved unless I went into the settings menu view and โclickedโ save.
Which leads me to ask a question - when a user logs in for the first time, does the usersettings pick up an initial value expression or do you actually have to go into the setting menu and click โsaveโ to create the record?
I wanted the usersettings to default to values in my โuserโ table - such as which company they represent and what role they have. I then use this info in the slice row filter to allow:
I also have a filter to only bring up the last 7 days, as well as only โActiveโ flag lines.
The filter I am using is as below - is this the best way to control my data?
and( [Date]>Today()-7,
OR([Useremail]=Useremail(),
AND([COMPANYLOG]=USERSETTINGS(โCompanyโ) , USERSETTINGS(โRoleโ) = โManagerโ),
USERSETTINGS(โRoleโ)= โADMINโ),
[STATUS]=โACTIVEโ)
To get around this not working i then used lookup() function below - is this suitable?
Seems to work on mobile device fine. My next thought was to setup virtual columns to pull in the user credentials to use in the same expression instead of lookup() function - would that work and is it a better way to handle data?
and( [Date]>Today()-7,
OR([Useremail]=Useremail(),
AND([COMPANYLOG]= LOOKUP(Useremail(),โUSERSโ,โUSER EMAILโ,โCOMPANYโ), LOOKUP(Useremail(),โUSERSโ,โUSER EMAILโ,โROLEโ) = โMANAGERโ),
LOOKUP(Useremail(),โUSERSโ,โUSER EMAILโ,โROLEโ) = โADMINโ),
[STATUS]=โACTIVEโ)
Thanks in advance if anyone can give some guidance and apologyโs for the long questions.
Cheers
Did you ever get any answers or figure it out?
User | Count |
---|---|
15 | |
11 | |
9 | |
8 | |
4 |