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.

Featured Replies

Ok I'm running into a problem I haven't seen fixed on here yet.

I have a large database with multiple records.

On one layout there is a possibility that when it prints it could be more then 1 page. It's even possible it's more then 5 pages. Just depends on the data that's been recorded for that particular record.

I'm trying to get it to read "Page x of y" where x= the current page in relation to that record and y= the total number of pages going to be printed but only for that record.

The second record should start back at Page 1 of z. Where z= the total number of pages going to be printed for the second record.. and so on and so on.

Any ideas?

  • Author

Yeah I read that thread but it's not what I'm going for.

Since I need to create something that reads

Page 1 of 2

Page 2 of 2

Page 1 of 5

Page 2 of 5

Page 3 of 5

etc.

Depending on the RECORD and how many pages were generated for that record on the particular layout.

As far as I could tell that post would give me (using the earlier example)

Page 1 of 7

Page 2 of 7

Page 3 of 7

Page 4 of 7

etc.

with no regard for how many pages each separate record actually has when it comes to print time.

Any ideas?

Run it as a loop using a Self Join relationship

Go to Layout ["PrintLayout"]

Show All Records

Go to Record/Request/Page [First]

Loop

Go to Related Record [show, "FileSelfJoin"]

Enter Preview Mode []

Go to Record/Request/Page [Last]

Set Field [gReportPgs, Status ( CurrentPageNumber )]

Print []

###

Enter Browse Mode

Show All Records

Go to Record/Request/Page [Next, Exit After Last]

End Loop

  • Author

Ok I see it I see it.

Now that looks as though it would only work if you wanted to print all the records.

We have finds and sorts to complete before hand.

But... I guess I could run the script without the print command and that would give me each record with a total pages for each record... then we could do our finds and sorts afterwards.

I'll run it and see what happens... and if I end up with more questions LOL

  • Author

Ok I ran that script and it just ran forever and did nothing

instead of

Go to Related Record [show, "FileSelfJoin"]

I think I'll do a find on gReportPgs = ""

Then follow it with

Omit [1]

Show Omit

I don't know if I wrote that correctly but I think you get the idea.

If you want to store the page number instead, you can run a script that stores it in a new field for the record. I have attached both ways.

page.zip

  • Author

thanks.

that works great in the file you sent but for some reason I can't get it to run when I put it into my database.

I get a page that's blank and asks if I want to continue or cancel the script and then I get nothing.

Any ideas why that would be happening.

I set everything up the same way you did and I can't seem to see any difference

Edit:

And now your file isn't working either... stupid computer.

Edited by Guest

  • Author

Well I can't post the file due to company restrictions but I might be able to create a test file to post.

Ok I've created a test file and removed a good chunk of the data. Oddly enough, now I'm getting the same response that I was getting from your file. It works for the first record but no others.

hmmmmm weird

I'll keep working on it

  • Author

ok I've tried downloading your file 3 times now and it's not working anymore. Maybe I just thought it was working the first time when it wasn't.

I try clearing out the page #s and running the script and only the first record comes back with a result. In the case of the file it's a "2" but record 2 and 3 are still blank.

Are you able to reproduce that error???

  • Author

Okay I think I came up with something that works.

Let me know what you think and if you can see any problems that might come from it.

Go to Record/Request/Page [First]

Go to Layout ["Layout Name"]

Show All Records

Loop

Perform Find [Restore] <- This is finding all gReportPgs = ""

Go to Records/Request/Page [No dialog, By Number "2"]

If ["Status(CurrentRecordNumber) = "2"]

Omit Multiple [No dialog, 9999999]

End If

Enter Preview Mode []

Go to Record/Request/Page [Last]

Set Field ["gReportPgs", "Status(CurrentPageNumber)"]

End Loop

When I run it.... if it doesn't find anything you're done. Seems to work.

  • Author

Okay I can now make the total page numbers by record.

How do I format it so that the Current page number is based off the record and not total pages shown?

I'm guessing it's in the formatting for the part but I haven't figured it out yet

LOL

Can you tell I'm not used to using page #s?

This would be a lot easier in FM7-8. However, you being on FM5, take a look at this new sample file. You can do a search for a found set then run the script in the Page.fp5 file.

page2.zip

  • Author

I agree with you there. I'm hoping we'll upgrade to 8 soon.

And thanks...

That worked perfectly. From my test, running that calculation should take about 10 minutes in my database.

Don't suppose you know how I can make the Status(CurrentPageNumber) restart at 1 for the first page of each record?

  • 3 weeks later...
  • Author

Seems I posted this in the wrong thread so here it is again

-------------------

Happy New Year everyone!

Not to resurrect an old thread and all but something here wasn't quite answered.

How would I get the page x of y to restart page x at 1 for each record?

Right now I have it and when I do my find and say 10 records come up each with different number of pages being printed for each, the page x keeps counting up.

If record 1 had 3 pages and record 2 had 2 pages and record 3 had 4 pages by the time I hit page 1 on record 3 it reads

Page 6 of 4

How can you have a page 6 of 4?:

I'm sure there's something easy to fix this I just haven't found it yet. Any help would be appreciated.

thanks in advance

  • Author

test file works fine for the "y" portion of page x of y.

I'm trying to figure out how to get the "X" portion of page x of y to work.

I'm sure it's something simple but I've never used page numbers before since I've only ever had to deal with single page documents up to this point.

Oh and we are going to be upgrading to 8.5 slowly over the year so that will make my life a lot easier.

I can not replicate your issue. If you open up the page.pf5 file, return a found set of lets say RecordID, 1, 3, & 4, and the run the script, you will get it to print the following:

RecordID 1: 2 Pages Total

- First Page (Page 1 of 2)

- Second Page (Page 2 of 2)

RecordID 3: 2 Pages Total

- First Page (Page 1 of 2)

- Second Page (Page 2 of 2)

RecordID 4: 1 Page Total

- First Page (Page 1 of 1)

  • Author

Oh ok I see what you mean. And I know now why my question seemed strange to you. Your solution unfortunately caused another problem but I believe I have it solved.

With your script it prints each record one at a time. We have thousands of records to do at a time and sitting at the computer hitting print wouldn't work, and when I tried it with no dialogue, the time it took to run the script was considerably more.

What I've done is the following:

I run the script so it sets the last page for every record.

Then we can do any finds we need to from there.

How I fixed the problem with "x" of page x of y is I selected the following on the "part formating" section

-Page break after every 1 occurences

-Restart page numbers after each occurence

This seems to work.

I never knew what those functions did.

Do you see any problems that might come from doing things this way?

Here is an update to the files in which I think may better serve you since you want a mass print of all the found records without previewing each record. Try it this way.

BTW, in your solution, I do not think you need.

"-Page break after every 1 occurences"

page_marked_v3.zip

  • Author

Actually I've discovered that I need the "-Page break after every 1 occurences" because there are more then one field and without it, I had fields from other records sliding up into records they didn't correspond with.

Thanks for the help.

I think I have everything figured out now.

*crosses fingers*

now to just finish the backend and everything will be ready.

  • 7 months later...
  • Newbies

I'm trying to use the concept of page x of y in FMP 8.5. You mentioned it would be easier to do in v7 or higher but I can't figure it out. I have looked at the page_marked_v3 and created similar scripts and relationships in my test file but am unable to make it work. Is there a magical option in the more recent versions that makes this function easier? Many thanks.

All techniques involve entering preview mode, displaying the last page, then putting that last page number into a global field.

For large reports with lots of summary calculations, the process of scrolling to the last page can take some time to complete (seconds to minutes) so it's not a solution I automatically include on each report.

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.