I'm looking for samples on querying Realm through RealmStudio

While new to Realm, am doing ok with querying it through my Swift app. Where I’m having trouble is figuring out how to enter queries through Realm Studio.

Currently not a problem going through my Swift app. But as I add more Classes and more data, eventually it’s going to get drawn out running the debugger just to test queries.

Thank you

Yes! That’s really the best way to do it.

Realm Studio supports basic queries but it’s not an ideal solution for more complex queries and subqueries - which is often the case.

This is especially true if you want to massage the data; additional filtering, sorting or just seeing what’s returned in a Results object.

In any Realm project, we always add a “Test” button to our UI that’s only visible during development that calls a func test() which we change the code on the fly to query and examine data from Realm.

Yes, I get that, and have a few “debug” buttons setup. But I still would like to know how to do queries from RealmStudio. One never knows then that will be much easier/necessary at a particular moment

I picture is worth a thousand words, and I think you’ll be shocked how simple it is.

In this use case I have a PersonClass and 5 objects were added to Realm.

I want to query for all person objects where the name is Jay.

  1. Click the PersonClass object on the left

  2. In the field at the top of the right side enter → name == "Jay"

  3. and the PersonClass objects filter (show the result) when typing the query is completed

That’s about it!

1 Like

Yeah, I can see how little you can do with that. but thanks for showing me.