I am stuck on this for a while. Any guidance to write this expression would be helpful.
I am trying to restrict the users to view a list of projects from the PROJECTS table if these projects are in the comma-separated list in the STAFF table.
With the formula below, I get yellow exclamation marks. If I chose a key and a label both for PROJECT_NAME exclamation marks are disappear but then I would have duplicates IDโs in my DATA table.
DATA[PROJECT] column is ref type to PROJECT and Valid_if expression is.
SPLIT(
SELECT(
STAFF[PROJECTS],
USEREMAIL()=EMAIL,),
","
)
Close, the default separator for a SELECT() formula is:
" , " - thatโs โspace comma spaceโ
Youโre using โcommaโ only - try adding the spaces on both side, that should work.
A potentially easier solution, one that would allow for possible further advancements, would be to include a โCurrent_Userโ slice.
Where [Email] is a column that holds the email a user will use to log into the app.
Then, instead of re-querying the Staff table you can just call the slice - which is holding your users record.
split(
Current_User[Projects],
" , "
)
Thank you for your attention, I tried this but it brings all project in a row, it doesnโt separate the list.
The problem is that I can not make a solid ref list to PROJECTS table.
Try:
SPLIT(
SELECT(
STAFF[PROJECTS],
(USEREMAIL() = [EMAIL])
),
" , "
)
Ahhhโฆ I know whatโs going on.
Iโve noticed that SPLIT() seems to โremoveโ the ref nature of a piece of data, in order to get it working youโll have to use a dedicated SELECT() to create the list with the appropriate type.
UGH. I know.
Youโll end up with something like this:
Select(Projects[ProjectID],
in([Project_D],
SPLIT(
SELECT(STAFF[PROJECTS],
USEREMAIL() = [EMAIL]
),
" , "
)
)
)
This is where having a Current_User slice comes in handy, then you could use something like this:
Select(Projects[ProjectID],
in([Project_D],
SPLIT(
Current_User[PROJECTS],
" , "
)
)
)
Yep, the output of SPLIT() is a list of Text.
Good call!
We should really see about getting that to maintain the type - especially for ref lists.
@MultiTech_Visions, Thank you for your time, and suggestions. I have created a user slice and played around with the expression to see if it works. But it seems that the problem is insoluble for now.
Itโs solvable - just a matter of getting the right formula down.
Earlier you mentioned
Try that for your split formula, instead of what I proposed.
If that doesnโt work, could you show us the list of projects thatโs inside the STAFF table? Itโs from this list that we need to compare things, so it might just be some simple technical thing.
So then, the expression below returns the corresponding project list with the broken reference
(yellow exclamation marks nightmares!)
SELECT(PROJECTS[PROJECT],
IN([PROJECT],
SPLIT(
Current_User[PROJECTS],
","
)
)
)
I add here pictures of the tables for getting better help.
These should be project IDs:
I thought the same but here is the problem that I donโt know how to solve.
I have constructed this list to have a dependent drop-down list based on project and block selection. I have 19 projects and each project has 20 - 40 blocks. So I have recurring project names in total 728 rows.
Would it be work if I construct another project list just contains the 19 project names?
And can I get working inline views by projects also by doing this?
Iโm afraid Iโm not clear on what youโre trying to accomplish:
In the projects spreadsheet, I had reiterant project names. I thought I could not make ref to all rows in that spreadsheet.
Please look at the picture below.
For that reason, I added another sheet called PROJECT_LIST that includes just the project names.
Now, I made this and it is working.
@Steve & @MultiTech_Visions thank your help.
SELECT(PROJECT_LIST[PROJECT_ID], IN([PROJECT_NAME], SPLIT( Current_User[PROJECTS], " , " ) ) )
Now in the spreadsheet in the DATA sheet, I have references of the project names which I donโt want as a result. I use app to collect data, for me the most important thing is spreadsheets. On the spreadsheet, I want project names.
If it is possible, I want to show users, the projects in which they are related, and project names in the backend data.
If this is the case, then I would suggest you add an additional column into the mix - one to hold the keys, then another to hold the names.
This way you can get the best of both worlds.
Your name lookup formula is pretty simple:
Select(PROJECT_LIST[PROJECT_NAME], in([PROJECT_ID], [_thisrow].[COLUMN_WITH_IDs]))
Thank you so much, Matt, your suggestion was brilliant.
This idea helped me a lot, but I made a little bit different. As you suggested I added in DATA table a project_id column, so the user just selects this and it writes backend the references, and for the project name I used a lookup formula and hide it in the forms. User limiting, references, and name in backend data all working.
Thanks a lot.
Your welcome
User | Count |
---|---|
17 | |
14 | |
8 | |
7 | |
4 |