Devin Posted March 2, 2016 Posted March 2, 2016 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
LaRetta Posted March 2, 2016 Posted March 2, 2016 (edited) 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 March 2, 2016 by LaRetta changed descending to ascending 1
Devin Posted March 2, 2016 Author Posted March 2, 2016 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.
webko Posted March 2, 2016 Posted March 2, 2016 3 hours ago, LaRetta said: Omit Multiple Records [ Get ( FoundCount ) - 10 ] [ No dialog ] Oh, that's nice.... I've always just used a very very big number...
LaRetta Posted March 3, 2016 Posted March 3, 2016 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. 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. BTW, this was picked up from Comment more assuredly although Ray Cologon used it as well.
Recommended Posts
This topic is 3255 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 accountSign in
Already have an account? Sign in here.
Sign In Now