Please see Wiki - how to post code on this forum. There's an edit (pencil icon) link below your question so you can fix it. Thanks.
You probably need to show us the named query configuration and explain how you know "it works fine". (How did you test it?)
Also, as a matter of interest, why not use system.db.runNamedQuery - Ignition User Manual 8.0 - Ignition Documentation?