About The Listing Record Limit

3 posts by 2 authors in: Forums > CMS Builder
Last Post: June 23, 2022   (RSS)

By Tom - June 18, 2022 - edited: June 20, 2022

Hello,

I've just upgrade from 3.04 (Build 2081) to 3.56 (Build 2304).

Since I have a very big database.

When I was using the old version.

I was told that there is only a 1000 field listed.

The solution was below.

If you want to change it, it's in /lib/database_functions.php in the function: getListOptionsFromSchema();
If you search for "LIMIT 0" you'll find this line:        $query        = "SELECT `$valueField`, `$labelField` FROM `$selectTable` $where $orderBy LIMIT 0, 999";

If you change it from 0, 999 to 0, 1499 then you'll get another 500 records.  

However after I upgraded to the new version of CMSB,

in /lib/database_functions.php, there is no such a code can be amended.

Please refer the the attach screen capture and advise.

Thank You

Attachments:

1000only.jpg 29K

By daniel - June 22, 2022

Hi Tom,

In CMSB 3.54 we added a filter "listFieldOptions_maxResults" that can be used to update this value without having to change core files. You can use a plugin like this to change the value:

<?php
/*
Plugin Name: List Field Max Results
Description: Set custom result limit for list fields that generate options from a CMSB section.
Version: 1.00
Requires at least: 3.54
*/

addFilter('listFieldOptions_maxResults', 'change_listFieldOptions_maxResults');
function change_listFieldOptions_maxResults($currentMax) {
  return 1500;
}
?>

Let me know if that does the trick, or if you have any other questions!

Thanks,

Daniel
Technical Lead
interactivetools.com