How can I limit the number of records returned from a glide query?

mpsteve137
Tera Expert

Obvious answer is the add the property:find_real_file.png

But even after adding this and running this fixed script:
find_real_file.png

I'm getting over 10 results:

find_real_file.png

Am I doing something wrong here?

1 ACCEPTED SOLUTION

This system property only works when querying a database view table.

Not normal tables.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

6 REPLIES 6

Allen Andreas
Administrator
Administrator

Hi,

To limit records returned in a query, you can use:

gr.setLimit(number);

That system property isn't going to affect that query.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Allen Andreas
Administrator
Administrator

Hi,

Can you also add in a getProperty line to see what it's reporting back?

So like: var prop = gs.getProperty('glide.db.max_view_records');

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

gs.info(gs.getProperty('glide.db.max_view_records')); is returning 10

This system property only works when querying a database view table.

Not normal tables.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!