LIMIT support

A quick note for agileBase developers – we now let administrators set the SQL ‘LIMIT’ value for each view.

The system already uses LIMIT to, well, limit the number of records returned by default to the top 25. Of course you can press ‘show more rows’ to load up increasingly more, which ups the limit each time.

However, now and again, you only ever want to see the top record or the top few records. For example, when setting up a report to email managers, you may want to include the top 5 or 10 customers/opportunities/salespeople/etc.

Or when setting up a todo list, you may want to create a view of just the one single ‘top’ entry. After all, as many people say, the longer your todo list, the less you get done! In fact, some apps such as NowDoThis do follow that principle.

For developers setting up more complex views, it’s sometimes advantageous to set up a view showing the top record in a particular criteria so you can ‘join’ to it and pull in the information. For example, if you want to see the most recent month’s invoices, first a view to find the 1 most recent month can be created by listing all months, most recent at the top, then setting a limit of 1. You can accomplish the same thing with other techniques e.g. window functions, but this is simpler.

Setting the limit

In a view’s ‘manage’ tab, select ‘advanced options’ and the option for setting the row limit will appear. Type in a number and it will take effect immediately.

limits

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s