Lookup value dynamically passed as a condition for action

Hi Gliders!

Is there a way to dynamically pass a specific lookup value as a condition for an action?

Here is my setup:

  • Users table with user provided preferred time slot
  • Class times table with “Available” “Not Valid” or “Full” status for each possible time slot in the week
  • I have setup a relation between the user_pref_time slot and class_timeslot

Challenge is…because users specify just the time slot, the “slot” is effectively repeated 7 times a week. Thus, the associated lookup column also pulls 7 values (mix of ‘available’ and ‘not valid’; the not valid ones being typically over the weekend)

When passing this as a condition (i.e. slot should be “available” for the user to be able to make their booking/execute the action) the condition only tests whether there is at least one “available” in the lookkup column. I need it to test whether it is a “available” for the specified day.

Short of separating out and breaking the relation and lookup into 7x2 different columns, is there any other way?

Thank you very much!

Instead of a relation, you might be better off using a Query. Then you can filter it by user, by day, and by status, eg:

  • User is signed in user
  • Day is Today (or selected day, whatever you are using there)
  • Status is Available

Then on your condition, test whether the Query is empty/not empty.

2 Likes

Thank you @Darren_Murphy! That worked beautifully.

I realise I have another challenge though - how can I set different conditions for repeating/sequential actions?

i.e. check for Monday → book Monday → then check for Tuesday → book Tuesday…

Do I create separate actions (one for each day) and chain them (can I do that)? or assign multiple actions to the same trigger/button?

Sorry for the branch off into a new issue.

I think I’d need to understand your data structure a little better before I can advise on that.

Can you show me some screen shots of the relevant data tables so that I can get a better visual?

Thank you Darren.

Here is how I have setup my tables:

I am struggling with is how to test and cycle through all 7 days and book all possible options for the week for a user?

In case it factors in, I plan to use Make to trigger a loop to repeat this action weekly for all eligible users (using your recommended approach to pass a JSON).

mmm, okay.

I think you might be overcomplicating this a bit.

Question: I’m not sure how your current flow works, but can you set it up so that a user first selects a day?

If you can do that, then you only need a single query column and a single branch in your action.
What you would do is create an extra column in the user profile row to hold the selected day. Then when a user selects that day, write the value to that column, and use it in the query. And then the action only needs to check that single query column, which will dynamically apply to all days.

1 Like