Data Source (And/Or)

I am in the process of buiding an application for my projects, using the application builder.

In the first instance I present a summary of tasks (table) to the user based on their username and the work status of the task (single select).

However, the applicable work status to create the view can be one of 3 options (Scheduled, In Progress, On Hold).

Therefore I need to configure my data source filter to be:
Where “Supervisor” has “User > Username”
And “Work Status” is “Scheduled”
or “Work Status” is “In Progress”
or “Work Status” is “On Hold”

However, the Filter does NOT a combination or AND/OR statements.

If I was using mysql, my sql would look something like:
SELECT * FROM tasks WHERE supervisior=“supervisor” AND (workstatus=“Scheduled” OR workstatus=“In Progress” OR workstatus=“On Hold”)

Is it possible to create a combination of AND/OR using a formula in the Data Filter?

Hi @Thorby,

To ensure I understand correctly, you’re aiming to filter tasks for a specific Supervisor and include tasks with the Work Status of either “Scheduled,” “In Progress,” or “On Hold.”

Given the current statuses you want to include, it appears you’re encompassing all possible options for the Work Status field. If “Scheduled,” “In Progress,” and “On Hold” are the only possible values, then the filter on Work Status doesn’t narrow down the results any further than just filtering by Supervisor. Or are there additional Work Status’es not mentioned in your post?

Hi Colin,

Thanks for coming back so quickly.

The Work Status has the following values (this is a working example):

[blank]

Not Scheduled

Scheduled

In Progress

On Hold

Completed

The Supervisor (the person managing the job) does not need to view Jobs that have a “NULL” value, that are “Not Scheduled” and that are “Completed”.

Therefore, their data filter should be something like:

Tasks where “Supervisor Name” EQUALS login “Username”

AND Work Status equals “Scheduled” OR “In Progress” OR “On Hold”

I could configure the data filter to read:

Tasks where “Supervisor Name” EQUALS login “Username”

AND Work Status does NOT EQUAL “NULL”

AND NOT EQUAL “Not Scheduled”

AND NOT EQUAL “Completed”

However, deploying the NOT EQUAL solution would be restrictive should we need to extend the list of Work Status in the Future, for administrative purposes (i.e. Preliminary, Set To Archive, Archived).

Many thanks.

Best regards,
Martin.

Hi Thorby, thanks for the clarification.

In that case, what I would do is make a new grid view in your table and then I’d add these filters to the view;

Then in your datasource for the app builder, you can simply choose this as the view and then you only need to filter where “Supervisor” has “User > Username”

Hi Colin,

I’m new to using Baserow and have encountered a similar issue regarding the “Datasource for the app builder” which doesn’t have “has”. I’m looking to create an onboarding page that users are directed to after their first login, where they can continue filling out fields other than Name and Email.

How can I filter the data to match the Email field with the logged-in user’s Email?
Any guidance would be greatly appreciated. Thank you!

ref: Data sources

Hi @Zionflow welcome to the forum.

Am I right in understanding that you want to create some form of onboarding flow where by you will essentially update the user’s table for a record filtered by the current logged in user?

In that case - you wouldn’t need to add a datasource to the page for this. You could add a form element and then add a text input element inside that form to capture data. Then on the events tab on the form you could create an action to update a row. Select the users table and then for Row ID you would select the current user’s ID and then use the text input element’s value as the value for the field you want to update.

Hi Colin,

Thank you so much for your detailed explanation. I appreciate your help and will give it a try. Your assistance means a lot to me!