Jump to content

finding last record of set


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

Recommended Posts

Hi all,

I've got a file that I use as a list that other files access. It contains each possible item for checkout. e.g. if there are 10 Hyperstudio CDs available for checkout there is a record Hyperstudio1, Hyperstudio2, Hyperstudio3, etc. Now I want to be able to print off a sheet of everything available for checkout, but I only want the last record to show on this sheet. That way we can see which items are available for checkout and how many without actually having a line for each record. How do I do a find for each item and get only the highest number of that particular item to show? Thanks.

Link to comment
Share on other sites

A script could work like this:

Find your set

Sort descending by numbered item field

Go to first record

Omit

Show Omitted

Now you have a found set of one record, and that record is the highest numbered record from your original found set. Go to print latout, print & etc.

Steve Brown

Link to comment
Share on other sites

Close...

Find your set

Sort descending by numbered item field

Go to first record

*Show All Records*

Omit

Show Omitted

If you don't perform the "show all records" step before omitting the record, the Show Omitted step will find all the previously "unfound" records in the database as well as the desired record.

Link to comment
Share on other sites

Hey, that's a great idea, and it works well (with Vaughn's "show all" input). But it only works well for 1 record. I need to do some sort of a loop that gets the omitted record for each find and puts it into some sort of running talley of omitted records, then, at the end, shows all the omitted records (the last record of each item). Could I do this by saving the omited record's individual RecordNumber into an array and then show each record of that array when finished? And, if so, how do I make that array? (I really don't understand how to use repeating fields very well, if that's how). thanks for everyone's expertise.

Link to comment
Share on other sites

You need some other way of identifying the records you want to find.

Or you could create a script that finds them all, sorts them, then omits the "duplicates".

I'd set up the script first and get it working, then work out a way (via a self-join or calc field) of identifying the last of each set in real-time and seeing which method is faster/better.

Link to comment
Share on other sites

Good catch on including a "show all" step. I'd overlooked it.

Regarding running the script over & over and finding a different record each time, then keeping track of these, it looks like it's as simple as setting up a basic flag field (a field that will contain either a 1 or nothing, usually displayed as a checkbox). When your script arrives at one record, include a step that sets the flag to 1. Eventually, when you are done, you could run a find on this checkbox, getting your set of all records originally found. Print, then include a clean-up step that replaces all checkboxes with 1 to nothing, for next time.

Unless I'm missing something again, there's no need to get fancy with arrays at all.

I do something similar, where I get a found set of ten or so. Then I have a looping script that gives me a found set of one of these (to export a single record), then moves on to the next one. All ten spend a moment as a found set of one in turn. I do this with counter fields that are set in the script to temporarily number the found set. If something like this is closer to what you need, let me know and I'll explain in greater detail.

Steve Brown

Link to comment
Share on other sites

The problem with "flag" fields is that it breaks really quickly in multi-user mode. Imagine two (or more) users making their own sets of records at the same time. Same with any script that numbers records...

Sure, you say now that it's only single user, but as soon as other people see how great it is they'll want to use it too... (been there done that).

Maybe you *really* need another related file that lists the number of items. Finding the last checked out item would then be really easy.

Link to comment
Share on other sites

This topic is 7926 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.