Use a variable in a query

Hi,

I’m doing a “beforeQuery” hook that need to have the following:

let newQuery = query.hasSome(“facility”,[‘98831200-9a08-45e3-bc3e-e4193d5dcd2a’, ‘1cd05398-87f7-4925-8ea7-98bc72045e4b’]);

this works perfect, but… i need to create the list of facilities from other query and than use it.
I don’t know the number of facilities. Can i do something like this?
let newQuery = query.hasSome(“facility”, facilitiesHasSome);
tried many different ways to populate facilitiesHasSome but cannot get to the right one.

What are you trying to do? What are you trying to accomplish through the use of .hasSome() ?

I have a data of customers in table that include all the facilities and I need the member to see only the customer related to the facilities he allowed to see

@shirieilon You need to supply more information. What does your database look like? How have you defined facilities? Members? Customers? How do you define access (allowed to see)?

We are unable to provide full code solutions, but we can get you headed in the right direction if we have the necessary information.