# realm

Christopher Mederos

10/20/2023, 12:54 AM
Is there any way to pass a map or list or query parameter values to realm's query function? The documents make it seem like you must construct a query string and varargs for exactly the number of parameters you want to query:
"progressMinutes > $0 AND assignee == $1", 1, "Alex"
Ideally, is there a similar syntax available like
"progressMinutes > $0 AND assignee == $1", queryParams.values
otherwise, it seems like we must write individual queries for every permutation of query parameters we intend to search a realm object by?
FYI - it can be done by casting a mutable list of params as an array and then using kotlin's spread operator -
Copy code
val results = realm.query<MyRealmObject>(query = queryString, *queryParams.toTypedArray()).find()
👍 1