I have a page, where I have a table showing the name of the Customers and the company they work at ( it's a many to one relation with the Companies data model, the relation is called Company), and a search bar below it. The search bar's value is binded like this:
@datasource.query.filters.Name._contains
which works perfectly fine, but I want the search bar to also filter the names of the companies, the customers work at, I tried
@datasource.query.filters.Company.Name._contains || @datasource.query.filters.Name._contains
But it isn't really working, so my question is, how could I filter both of these fields for my table?
For this specific scenario I would recommend to use a query builder in your datasource. The query builder should look like this:
Name contains? :searchVal or Company.Name contains? :searchVal
Then the value of your search bar should be binded like this:
@datasource.query.parameters.searchVal
Please refer to the official documentation below for a more detailed explanation:
Reference: https://developers.google.com/appmaker/models/datasources#query_builder