[Vtigercrm-developers] vtws_query_related with ORDER BY clause?

Alan Lord alanslists at gmail.com
Tue Aug 25 10:01:04 GMT 2020


Just to finish this thread you can also use ORDER BY clauses in this 
extra argument, e.g.

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

Hope that helps.

Al


On 25/08/2020 10:52, Alan Lord wrote:
> I wrote too soon ;-)
> 
> https://code.vtiger.com/vtiger/vtigercrm/issues/1464
> 
> Some documentation would have been helpful guys...
> 
> Al
> 
> 
> On 25/08/2020 10:47, Alan Lord wrote:
>> This is becoming a right PITA.
>>
>> https://code.vtiger.com/vtiger/vtigercrm/issues/1464
>>
>> using vtws_retrieve_related, or vtws_query_related, it is not possible 
>> to get more than the first 100 records...
>>
>> Al
>>
>>
>> On 13/07/2020 12:24, Uma S wrote:
>>> Thanks! for the notification Alan. We will review this post release.
>>>
>>> On Fri, Jul 10, 2020 at 2:20 PM Alan Lord <alanslists at gmail.com 
>>> <mailto:alanslists at gmail.com>> wrote:
>>>
>>>     anyone?
>>>
>>>     On 07/07/2020 13:30, Alan Lord wrote:
>>>      > 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.)
>>>      >
>>
>>
>>
>> _______________________________________________
>> http://www.vtiger.com/
>>
> 
> 
> _______________________________________________
> http://www.vtiger.com/




More information about the vtigercrm-developers mailing list