Reports - using script data source sample flag or other preview limit

In reports, we use the script data source more than any other method. Is there a way to limit the preview queries when in designer, but keep the full data without having to manually type in a limited query selection (Select top 3, etc…) in our system.db runQuery or PrepQuery?

Since we mostly use scripting, we need to update and test our reports a lot. We almost always use the system.db.runQuery or runPrepQuery, then use ‘for’ loops to do tag calculations which become extensive. This causes opening the design or preview tab loading everything and taking a long time, so we have to type in a “select top” limiter in all the places we use a db query before we do that, test it, then change it back. This itself takes time, but also can cause us to forget to change it back sometimes.

Is the “sample” flag argument something we can implement for this or any other best practice? I don’t see any documentation or anything on the forums about this.

I don’t know if this is good idea or not, but you could create your own functions that ‘wrap’ the system.db functions and have a sampleMode parameter that automatically rewrites the provided queries to have a limit.
On the backend, the ‘preview limit’ for queries is implemented at the JDBC ‘Statement’ layer, which we deliberately don’t expose users to, because it’s both very verbose and very complicated.