Page 1 of 1

HTML reports shows only first 30 records of a relationship

PostPosted: Sat Mar 02, 2013 3:49 am
by patrei
Hi all.
I'am using the new htmlreports module and noticed that when I map a relationship to an html table, only the first 30 records are fetched and shown in the table.
This happens both in preview and in record_action.
Setting default_limit=500 in conf.ini does not solve the problem.
Is there some implicit limit to the number of related records retrieved by htmlreports? How can this limit be changed?
Thanks
(Xataface 1.9 3856)

Re: HTML reports shows only first 30 records of a relationsh

PostPosted: Sat Mar 02, 2013 1:29 pm
by shannah
Yes.. This is a bit of a shortcoming right now. The related lists in reports calls getRelatedRecordObjects() which only loads the first "page" of related record results - which is default 30 per page.

You can use the Dataface_Table::setRelationshipRange() method to adjust this default value. A good place to do this would be in the table's init() method of its delegate class as it is called once per request just when the table is first loaded.

e.g.
Code: Select all
function init(Dataface_Table $table){
    $table->setRelationshipRange('myrelationship', 0, 100);
}


Alternatively, you could modify the classes/XfHtmlReportBuilder.class.php class and look for all invocations of getRelatedRecordObjects() (there are 3), and add a 2nd parameter 'all' to them. E.g.

Code: Select all
$record->getRelatedRecordObjects($relname, 'all');


That will force it to load all related records instead of just the first 30.

-Steve

Re: HTML reports shows only first 30 records of a relationsh

PostPosted: Sun Mar 03, 2013 8:09 am
by patrei
Thank you Steve for your quick reply.
I modified XfHtmlReportBuilder.class.php as you suggested and everything is ok now.
By the way, Xataface is great!
Patrick