Jump to content
Server Maintenance This Week. ×

Looping and Omitting Records


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

Recommended Posts

  • Newbies

I've read most of the old posts and really could use help.

I'm performing a Find, then within that set, I'm looping to omit any record where Exported = 'yes'.

However, I've run into the problem where Omitting a record automatically goes to the next record! So I end up with half of what i need. I could just take out "Go to Record/Request/Page

[ Next, Exit after last ]" but then how do I exit the loop?

I tried Exit Loop If [status(CurrentFoundCount) = Status(CurrentRecordCount)] but it zeroes out the records and exits the script.

Any help really appreciated, script below:

Show All Records

Perform Find [ Restore find requests, Replace Found Set ]

Sort [ Restore sort order, No dialog ]

Go to Record/Request/Page

[ First ]

Loop

If [ Exported = "yes" ]

Omit Record

End If

Go to Record/Request/Page

[ Next, Exit after last ]

End Loop

Export Records

Link to comment
Share on other sites

This should work:

Show All Records

Perform Find [ Restore find requests, Replace Found Set ]

Sort [ Restore sort order, No dialog ]

Go to Record/Request/Page [ First ]

Loop

If [ Exported = "yes" ]

Omit Record

Else

Go to Record/Request/Page [ Next, Exit after last ]

End If

End Loop

Export Records

However, you may find it easier to simply add a request to the original Find for a "yes" in the Exported field with the Omit Record option.

Link to comment
Share on other sites

It's useful to note: When searching on a unstored calc (in FM5/6), that looping-omit method usually performs better, especially if an initial Find on indexed criteria can first narrow the found set to much smaller number of records for the loop to process.

Link to comment
Share on other sites

This topic is 6559 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
×
×
  • Create New...

Important Information

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