I often find myself trying to search the data tables based on the value of a linked row. It would be great to be able to do this using the Anvil query API.
For example, say I have an app with a Users table and another Comments table with a single row reference to that Users table. Now (for some reason) I want to search my Comments table for all users that have a gmail address. I’d like to be able to:
I know that I can achieve this using list comprehension (or just *user_search), but in both cases I have to load the entire search object, and give up the laziness of the search iterator. This is devastating to performance as the database grows, so my request is specifically on how to achieve this while pushing the actual work to the database (which will be very good at this job!).
I don’t think this is possible given the current query system, but wanted to check to see if anyone knew how to do it.
I’d like to query based on fields in linked tables. For example, if I’m querying an order items table and it has a link to an order row, I’d like to be able to query based on the date of the order. Something like:
I have a couple of workarounds in mind, but they either use up additional space in the data tables (denormalizing to store the date in the order items), or additional time on the server (fetching the order rows so I can query order items using q.any_of).
Does this feature exist and I just can’t work out how to use it?
Lazy search iterators are a big win for data tables. Can you emulate something like that for a data grid to use when you’re going to an external database?