[Vtigercrm-developers] vtws_query_related with ORDER BY clause?

Alan Lord alanslists at gmail.com
Tue Jul 7 12:30:58 GMT 2020


I'm looking at the vtws_retrieve_related and the vtws_query_related apis.

vtws_retrieve_related is OK - but it is limited in the sense you get 
back everything.

I would like to, maybe, add LIMIT and/or ORDER BY clauses...

If I keep the query extremely simple, e.g.

> $query = "SELECT * FROM HelpDesk";
> $data = vtws_query_related($query, '11x566', 'HelpDesk', $current_user);
> print_r($data);

Then it works - but I can't add an ORDER BY clause. I couldn't add a 
simple WHERE clause either. The VTQL_Parser threw an exception no matter 
what I tried.

Is it possible to use an ORDER BY clause? Can you provide some 
documentation and/or examples? If not - what would a Marketplace module 
have to do? Would it have to iterate/post process *all* the returned 
data to effectively introduce ordering and/or limits?


Also, I note that in my simple query above, unlike vtws_query, if I 
include the semi-colon in the query the query fails. This isn't 
consistent - in vtws_query you MUST terminate the query with a ";".
(I expect it is the preg_match test in QueryRelated.php that is causing 
this.)


Cheers


Al






More information about the vtigercrm-developers mailing list