Limit in related table lookup?

5 posts by 2 authors in: Forums > CMS Builder
Last Post: March 1, 2012   (RSS)

Re: [rjbathgate] Limit in related table lookup?

By Jason - February 29, 2012

Hi Rob,

What version of CMS Builder are you running? If you could send in a [url http://www.interactivetools.com/suppport]2nd Level Support[/url] request we can take a closer look into this for you.

thanks,
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Limit in related table lookup?

Hi,

Thanks Jason, have sent 2nd Level Support Request,

Cheers

Re: [rjbathgate] Limit in related table lookup?

By Jason - March 1, 2012

Hi Rob,

I took a look into this and I learned something new about CMS Builder! :)

It turns out that cms builder imposes a limit on the number of options that can appear in a drop down list. By default, this limit is set to 999, which is why some of your options don't appear.

There are a couple of ways you can approach this. If your records are being populated by a front end form and not manually through CMS Builder, then this limit won't make any difference for you. The :label pseudo field will still get populated. So you could output the customer name like this:

<?php echo $record['customer:label'];?>

Take a look at the test page you put up to see this in action.

The other option would be to increase the limit from 999 to something greater. This can be done in cmsAdmin/lib/database_functions.php

In the function getListOptionsFromSchema() you'll see a line that looks like this:

$query = "SELECT `$valueField`, `$labelField` FROM `$selectTable` $where $orderBy LIMIT 0, 999";

You could increase this if you want. This is not the best option, however. If you get sufficiently large lists, you could slow down your page trying to load all the records. Also, since this would be a custom change, it would be overwritten as soon as you upgraded your version of CMS Builder. I would recommend using the customer:label option.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Limit in related table lookup?

By rjbathgate - March 1, 2012

Hi,

Thanks! Good debugging :)

I've had to go for the increased limit option, as the problem occurs both front end and within cmsb admin itself.

It's working fine now, and the installation has a bunch of other custom stuff too so not a new problem re upgrading overwrites!

Thanks again, much appreciated,
Rob