User Specific Columns & Collection-level Actions

Hi there,
I have a ‘Reports’ table with a ‘New Alert’ column (True/False), which is User-specific. When a User wants to get updates on a report, ‘New Alert’ is set to True for that User on the Reports table.

On the ‘Alerts’ screen, there is a ‘Remove’ button on each item which changes ‘New Alert’ to False for that report.

I also added a Title Bar Action button, to allow users to ‘Remove All’ to clear that screen. This first sets a flag on the User table (‘Clear all Alerts’ =True), so we can check if set in the batch run. Then it tries to clear the ‘New Alert’ field on the Report table for all reports, but I cannot get it to work:

  1. When I create a workflow behind the ‘Remove All’ button, only the first Report on the table gets set to ‘False’ even though the action is at the ‘Title Bar’ table-level and not at the row level.

  2. I’ve also tried using Loops with the ‘App Interaction’ trigger, but it doesn’t allow Loops (thanks to this forum for clarifying that!).

  3. I then created a ‘Scheduled’ trigger, as we could run batch clearing if needed, but this also does not set the ‘New Alert’ (user-specific) column to False on the Reports table. I checked the Workflow Step Logs and it successfully goes through both loops and seems to do what is needed on the correct column for each report …

{
“updates”: {
“FBj8U”: “False”
},
“tableName”: “Sample Reports for April”
}

… but the data on Reports table is unchanged.

This is what the workflow looks like:

Any help on this would be great!

I think the issue you have here is because you’re working with a user-specific column.

Workflows can not imitate a specific user to act on data of that specific user.

Is it possible to store a list of reportIDs that the user wants to get the alert for instead, in the Users table, as a basic column?

What does the alert flow look like?

1 Like

Hi @ThinhDinh , many thanks for your comment, and sorry for the late reply - I’ve been trying to do what you suggested but I’m not getting there!

I’m fairly new to Glide (only building workflows now and learning about arrays etc.), so there might be many things I need to fix below.

Here is what happens:

  1. In User profile, a User can select as many ‘Topics’ as they are interested in, from a ‘choice’ list. If it was for movies, for example, they could pick ‘thriller’, ‘drama’, ‘sci-fi’, ‘historic’, ‘comedy’ etc. from a choice of movie Topics (I have a separate table with ~ 150 Topics).
  2. The Users choices are saved in a ‘Alert Topics’ text field on the User table, and I use a ‘Split text’ (by comma) field to separate them out.
  3. When new movie reports are added to the App each night, they would be tagged with one or more ‘Topics’ e.g. ‘drama’, and ‘historic’.
  4. We want to alert those Users that have chosen, for example, either ‘historic’ or ‘drama’ (or both, of course) that a new report is available by showing a list of all matching reports on their ‘My Alerts’ screen.
  5. Reports will stay on the ‘My Alerts’ screen until a User ‘clears’ each Alert in the list, or they can also ‘Clears all Alerts’. As such, a User could end up with hundreds of Alerts on that screen. Currently, I was trying to filter the Reports collection on ‘My Alerts’ screen using ‘Show Alert’=True - this is the User-specific column I created in the Reports table.

Based on your suggestion, at a high level, it seems like I should do something like this:

Loop through all NEW Reports (filter on ‘Report Status’ = ‘New’) for that night;

Loop through all Users that have ‘Alerts count’ > 0 (i.e. subscribed to alert(s));

  Loop through all Topics for each report;
      
      If New Report 'Topic' is **included in** User's 'Alert Topics';
           Mark the Report as an Alert for that User in some way.  
 
 Else, do nothing (no Else needed). 
  • I’m not sure how I can check a ‘set of topics’ on a report against a ‘set of topics’ a user is interested in Glide. Is it possible to cross-match individual items in 2 different arrays?

  • When there is a match, I think you suggest saving the Report ID in a new field on the User table. How could I do this in a way that Users can remove individual Reports from ‘My Alerts’ screen. Would the new field be an array or something that can be added to / removed from as needed?

Many thanks for your help.
Mim

That’s a very sound approach. I don’t think I would change that much. Let’s keep everything until step 4.

So, you have a relation/query of all matching reports, and then a user-specific boolean column to indicate whether they have read it or not.

  • If you haven’t, add an “Added at” column to your reports table, that stores the timestamp at the point of adding.
  • For your “Clear all Alerts” button, add a “Last clear all” column to your users table. The “Clear all Alerts” button would write the current timestamp to that column, in your signed-in user’s row.
  • Filter your matching alerts by either “Show Alert = True” (I would have assumed you do something like “Read?”, and hide an item when “Read” is true instead), OR the “Added at” column is before “Clear all Alerts”.
1 Like

Hi @ThinhDinh,
I’m still not getting there on the final part of setting a ‘(Get) New Alert’ flag.

Below is my workflow:

  • Loop through Sample Reports: I filter on a hardcoded date and it correctly loops through the 3 reports that have that date.
  • I then loop through the array of ‘Topics’ each report has. Between the 3 reports, they have 10 different Topics.
  • For each of those 10 Topics, I then go through the Users table which I filter on Users who have ‘Get In-app Alerts’ set to True. For my test, I only set this on for 1 User to keep it simple.
  • It checks if ‘current Topic’ (from topic array item 1, in Sample Report 1, for example) is included in the list of Topics my User wants to be alerted about. It correctly identifies that 4 (of the 10 topics) match the User’s topics of interest.
  • Finally, I want to set the ‘(Get) New Alert’ flag against the matching Report in Sample Reports, but only for that User. Although the workflow log thinks it has done it correctly (see the 4 on that step), nothing is actually set because it is a ‘User-specific’ column, and even though it knows exactly who the User is, and it should be able to set the flag on the Report for that User, it seems (as you said) that Glide cannot do it.

Is there another way I can do the final step, so that it is saved to some User field instead - should it be an empty array that gets added to each time, with the Report ID for example? If so, how could I build the ‘My Alerts’ screen as it needs to be based on the ‘Sample Reports’ table rather than the User table?

Many thanks
Mim

I think you’re still trying my original suggestion. I would suggest abandoning that since you have a good approach already, and try this.

1 Like

Hi @ThinhDinh, I have worked out a solution now.

Many thanks again for your help.

1 Like

Great to hear!

1 Like