Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Index Page or Table of Contents

Featured Replies

I'm a beginner. I've looked everywhere and can't find how to do this, and it seems simple.

I'm basically just trying to create a table of contents what will display the page number of the records. For example, I have several names with information.. maybe like 100 pages worth of information. I am just trying to create a table of contents at the beginning of this page, where it shows me the record/name and what page number it's at.

How do I do this? I'm very new, so please explain easily!!! thank you soooo much!

Original:

Welcome to the Forums.

This should be pretty easy to do, but first a question: do you mean you've got about 100 different records, each of which is a page, or 1 record that's 100 pages, or something in-between?

If you've got 100 different records, you can make a layout that's a list (go to Layout-> new layout and follow the directions), and start from there. Let us know your answer, and we'll get you on your way.

-Stanley

  • Author

So basically there are like 400 records and when printed out, it turns out to be 100 different pages. I just want an index page at the beginning where I can print out and have a hard copy so I can look at the title and see what page its on and then go to it.

I have dones the list layout, but it doesn't do the page number function im looking for. thanks!

  • Author

oh and to answer your question... its 100 records, maybe about 2 or 3 records per page.

just think of the yellow pages. I want to create the beginninng index where it tells me what page my record is. thanks

Original:

Ooh, multiple records per page. Slightly tricky.

First, you may not know, but you can put the text "##" (no quotes, just the two number signs) on a layout, and when printed it will print the page number there for you. However, this is just printing data, and cannot be used in scripting.

Now, if you do not know how many records will go on a given page, I do not know of a way of seeing what page an item will be printed on. If, on the other hand, you set your pages up so that they will always show (say) two records, you can calculate the page number by using Status(CurrentRecordNumber), dividing that by two, then adding one. This doesn't sound like the solution you're after, though.

Perhaps someone else here knows a devious tricky way to solve your problem.

-Stanley

You need two fields for this: a global field (gPage) and a text/number field (Page) that will hold the number of the page on which the record will be printed. Then the script:

Show All Records 

Loop 

	Enter Preview Mode 

	Go to Record/Request/Page [ Last ] 

	Set Field [ Products::gPage; Get ( PageNumber ) ] 

	Enter Browse Mode 

	Go to Record/Request/Page [ Last ] 

	Set Field [ Products::Page; Products::gPage ] 

	Omit Record 

	Exit Loop If [  not Get ( FoundCount ) ] 

End Loop 

Show All Records   

Comment:

The user is on FMP 6, so the Get() calls have to be rephrased as Status() calls. Other than that, I'm trying what you've got, and it's giving me "1" for all pages.

-

Wait, I take that back. It works. I had a script step out of order.

Okay, Original, you want to do exactly as Comment's script says, but with these alterations:

Where it says "Get(PageNumber)" you want "Status(CurrentPageNumber)"

Where it says "not Get(FoundCount)" you want "Status(CurrentFoundCount)=0"

What this script will get you is the page number each record is on. As far as implementing that as an index, you're going to have to wait a minute, as I'm doing something else right now. Perhaps someone will jump in ahead of me.

-Stanley

Sorry, didn't notice the user's version. The index is as you said - just a list layout. If the index is at the beginning, then the number of index pages need to be added to the calc in the script, i.e.

Set Field [Page ; gPage + n ]

Original:

Now, to do your table of contents, you'll need a new layout, created by following these steps:

1. Enter Layout Mode

2. Go to Layouts-->New Layout/Report

3. Select "Columnar List/Report" and click "Next"

4. Select "Constrain to Page Width" and click "Next"

5. Pick the fields you want, but for now just the record's name and the page number, and click "Next"

6. Select the page number, and "ascending order", and click "Next"

7. Pick a theme (this is for print, so something suitable) and click "Next"

8. Skip the header and footer for now

9. Skip the script for now

10. Click "View the Report in Layout Mode" and then "Finish"

10a. Enter Browse Mode

10b. Go to Records-->Sort... and select your page field, ascending, and "Okay"

10c. Enter Layout Mode

11. Go To Layouts-->Part Setup... and select "create ..."

12. Select "Sub-Summary when sorted by" and, on the right, your page number field.

13. In the dialog that opens, select "above"

14. Click "done"

15. Move your page field up into the summary row (between header and body)

16. Go To Scripts-->Scriptmaker

17. Type in a script name, say "Table of Contents", then click "create"

18. Delete all the script steps on the right and make the following script:

Show All Records

Go To Layout [your new table of contents layout]

Sort [Restore; No Dialog]

Enter Preview Mode

19. Click "Done", then "Replace" beside "sort order" in the dialog box that appears.

Enter browse mode, and run your script. This should create your TOC.

If something's not right there, it's my fault.

-Stanley

One more note: this won't work well if records are allowed to span across pages. It notes the page on which each record ends.

Good point.

-Stanley

  • Author

wow, ok thanks guys... im going to try this out.

  • Author

ok, i must be doing something wrong.

I did the script, and in my layout I have placed the GPage field and the Page field. I then go to browse and i click on execute that script.

From there, the Gpage field shows the total pages in the file, but it doesn't show each page for each record. what am I doing wrong? thanks.

  • Author

oh my! I just looked and I had an extra PAUSE when it says ENTER PREVIEW MODE []

it works! I have no idea how, but it works. amazing. it seems so complicated for something so simple, but thanks for all yourr help!

Original:

Glad to hear you've worked it out.

-Stanley

I must be doing something wrong with this -- and I can't work it out...

The script to set the page numbers is OK but the result in preview mode is a record per page with the title and the page number at the top of each page -- there is no list of titles and page numbers on the first page.

I have set the layout as described with a subsummary sorted by page number (in which is the title and page fields) above the body with the record text field in this.

What am I doing wrong?

Any help with this is appreciated.

Did you try setting your layouts to View as List?

Yes it is set to view as list.

Perhaps you don't realize there are 2 layouts involved here.

The script finds on which page each record will print in your existing layout.

To get a Table of Contents page, you need to create a separate, columnar, layout.

Thanks -- I didn't realise that. I've got it working now.

thanks again

  • 4 years later...

I am using the gpage, Get Record # technique (modeled after the original script provided) to generate an index for a Jobs subsummary report grouped on Project Name. It worked perfectly until the client asked me to add a trailing subsummary part and Grand Summary. Now, the first Project Name, although it appears as the first entry in the index, does not have a page number listed although the page numbers are displayed and correct for all other project names. Record groups are allowed to break between pages.

Update - I checked the job records for the first Project Name and they all display the proper index page number. So the script is working properly. The Table of Contents (a simple Header, Body, Footer layout with merge text <>......<> is just being weird. I tried allowing additional space in the Body part so there is no chance the merge text is touching the header or footer but that didn't make any difference. I deleted the merge text and copied the text from my test platform that does display the first page number but that didn't fix it either.

Edited by Guest

Can you reproduce the problem in a new file? If so, post the file. If not... well, you know what that means.

I created a completely new layout and added the merge text using copy and paste from the test file that displays properly. Still no joy. I deleted the merge text and typed it in manually on the new layout. Nope! So, I deleted the <> from the merge text and inserted the IndexPage field itself. Then I could get the Page Number to display. I've run into this problem before with merge fields displaying intermittently and deleting the merge field and adding it back manually to the merge document usually corrects the problem but not this time. Sigh.....

Another test. If I try to add any additional text after the Merge field ProjectName, it does not show up on the first line but all lines thereafter in list view. So, in other words, I can add the merge text <> then add separate merge text <> but if I try to connect the two merge fields with text like periods or dashes, nothing shows up on line 1 except the ProjectName even though everything below that shows up properly.

This file has been so mauled by so many different developers over the years I fear it is becoming corrupted. I noticed that I cannot move scripts up and down in Scriptmaker any more either.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.