Jump to content

Limit record count in Found Set


Devin
 Share

This topic is 2305 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I'm needing away to limit the the Number of records for a found set.

In this example I have a single table. with three fields.. PONumber, OrderNumber and OrderDate.

I want to create a script to find the 10 Oldest "PONumber" by "OrderDate with an empty "OrderNumber"

Any help is greatly appreciated.

Thanks

Link to comment
Share on other sites

26 minutes ago, Devin said:

I want to create a script to find the 10 Oldest "PONumber" by "OrderDate with an empty "OrderNumber"

 

Hi Devin,

There might be better ways of handling it rather than performing a find.  But if you simply wish for a find to achieve what you indicate, you might try this (untested):

Set Error Capture [ On ]
Perform Find [ order number: “=” ; Restore ]
Sort Records [ orderDate ; ascending ]
Go to Record/Request [ 11 ] [ No dialog ]
Set Error Capture [ On ]
Omit Multiple Records [ Get ( FoundCount ) - 10 ] [ No dialog ]

 

Edited by LaRetta
changed descending to ascending
  • Like 1
Link to comment
Share on other sites

This looks like it works based on a few test.. Never used the Omit  Multiple Records like that.. Very cool.

Quick question.. why are you turning on Error Capture twice? I thought you only needed once per script.

Thanks.

Link to comment
Share on other sites

13 hours ago, Devin said:

Quick question.. why are you turning on Error Capture twice? I thought you only needed once per script.

I simply got side-tracked, Devin.  I started to add additional steps of if/else on the error trapping, saw I wanted to change the sort order, and then got pulled away on something else.  :pounce:

Setting error capture on once is usually enough but there are exceptions where one might turn error capture back off then later turn it back on again.  

11 hours ago, webko said:

Omit Multiple Records [ Get ( FoundCount ) - 10 ] [ No dialog ]

Oh, that's nice.... I've always just used a very very big number...

I know what you mean!  I've concluded that, no matter how large a number I guess, some day years later that table might surpass that record count and then the script would fail.  It seems that, no matter how well we humans try to predict where we'll be in future with anything, we greatly underestimate.  Exact is reassuring. :smile3:

BTW, this was picked up from Comment more assuredly although Ray Cologon used it as well.

Link to comment
Share on other sites

This topic is 2305 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.