To further describe the context, users are able to attribute or remove medical device to participants in research context. I have a data table to track audit trail (each attribution or removal, with date). What i want is that a given user can extract the audit trail data, but limited to the research he participates in (“Type Utilisateur”), whichever was the user that attributed/removed devices, as long as it belongs to the same research team.
In the app, using filter, i can make user to see only audit trial for the study they participate, but when i create the button to extract csv, the whole data is extracted. If query or relation is adapted, please, could you further describe how you would proceed ?
Thank you very much for your kind support.
Regards,
Tristan
If I have well understood your use case, in your example:
Bonnevie Tristan should get all the records because you are belonging to “Etude faisabilité clinique” and also to “HYBREATH”
Test utilisateur should only retrieve rows 5 to 8 because he/she is only part of “Etude faisabilité clinique”
As Jeff suggested, a Query seems to be the best solution. To achieve that, we first need to list for each User what “Type utilisateur” he/she is part of.
To showcase this, I created a sample “Audit trail_test” table like this:
Now, let’s go for the hard work . In the Users table:
Create a Relation column (mine is named All Type utilisateur (relation)).
You want to find all records of Audit trail_test > Utilisateurs that match the User > Name. Be sure to select “Match multiple” to find… multiple records. And don’t worry about the data displayed, it’s the value of the first column of the table. It just the way Glide tells you “I have found theses results!”.
Create a Joined List column (All Type utilisateur (joined list)). You join texts in All Type utilisateur (relation) > Type utilisateur to get all the values of Type utilisateur available for this specific user row.
Create a Query column (Records for Type utilisateur). This way, you can bring all the records where Type utilisateur is in the list of this user Type utilisateur. Same here, be sure the click on “Match multiple”.
Keep using your Audit trail_test table and filter it out as you mentionned
Use this Query as the source of your Collection (Data Grid in your screenshot). It’s probably more secure and efficient because if you change your Query to add more filters in the future, you’ll only have to apply the modification in the Query definition and it will be reflected in the view (but, you also might want to display something different of course)
as Jeff, I have all HYBREATH rows because I have at least one row HYBREATH. I don’t see EFC because I have no row like that in the Audit trait_test table.
BONUS: by clicking on “Select columns”, you’ll be able to select only the relevant columns you want in the export and also rename them (pretty cool feature I wanted to mention )
In a nutshell: the Query column lets you retrieve data from another table and apply filters. This query can then be used as the source of a component or to aggregate data (such as counting the number of rows)