Skip to content

vt730: How to get more than 100 records using vtws_retrieve_related?

When using vtws_query_related if there are more than 100 related records, the api returns only the first 100.

It is possible to retrieve a total count using vtws_query_related, e.g.

$query = "SELECT COUNT(*) FROM SalesOrder";
$relatedCount = vtws_query_related($query, $accWSId, 'SalesOrder', $current_user);

However it is not possible to add a LIMIT clause with this API - it fails.

$query = "SELECT * FROM SalesOrder LIMIT 100, 200;";
$moreRelatedStuff = vtws_query_related($query, $accWSId, 'SalesOrder', $current_user);

PHP Fatal error:  Uncaught WebServiceException: Syntax Error on line 1: token 'WHERE' Unexpected WHERE(WHERE), expected one of:  in /var/www/html/dev/include/Webservices/VTQL_Parser.php:1502

As I mentioned before here http://lists.vtigercrm.com/pipermail/vtigercrm-developers/2020-July/038724.html it seems the parser really doesn't want anything other than the very simplest of queries.