[Coldbox:3.5] Static query passed by reference

I am trying to build a static query from multiple function calls. Since I am using a RunEvent and knowing that the query get passed by reference I am assuming that the query will keep changing.

So i ma calling one function once and passing the required params to it . THe end result the second function will append rows to the static query.

Now I am calling another function passing all required params , so what should happened is should append rows to the static query but instead in make the static query blank

Also i’ve notice if I just use queryNew it keeps tell me that can not find the variable name in rc collection.But Once i’ve added the

newRow = QueryAddRow(rc.myQuery, 1);

then it start appending

Thank you