Jump to content

Help finding last record


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

Recommended Posts

I have the following.

Category......StartPage#

Jazz..........1

Jazz..........1

Blues.........2

Blues.........3

Rock..........4

Rock..........5

I need to populate a new field that will contain the ending page number of the category. I’m not sure whether this requires a script that populates a global field or just a calculation field.

The end result would look like this.

Category....StartPage#....EndPage#

Jazz........1.............1

Jazz........1.............1

Blues.......2.............3

Blues.......3.............3

Rock........4.............6

Rock........5.............6

Rock........6.............6

Thanks in advance for any help.

Edited by Guest
Link to comment
Share on other sites

Start with the last record and loop your way up with a script like this:

Sort // in the order of your example

Go to record (last)

Set variable ($cat ; "")

Loop

. If ($cat <> category)

.. Set variable ($cat ; category)

.. Set variable ($page ; StartPage)

. End If

. Set field (EndPage ; $page)

. Go to record (previous, exit after last)

End Loop

Link to comment
Share on other sites

You could also create a self join

Tables:

Table 1

Table Selfjoin

(the relationship would be Category =Category) and sort descending by Start Page#

Then if you show Table Selfjoin::StartPage, you'll see the highest page#.

I'm attaching an example.

Hope this works :

Martha

test.fp7.zip

Link to comment
Share on other sites

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