Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I print 2 certificates which form a pair, previewing each in a standard form layout first. Each has its own 'preview' script. All certificates/records are deleted via 'print' and 'cancel' scripts.

Certificates from related record nos 9001, 9003 & 9005 will display pages numbered 1 of 6, 3 of 6 and 5 of 6, whilst related record nos 9002, 9004 & 9006 will display with certificates with pages numbered 2 of 6, 4 of 6 and 6 of 6 (totals are likely to be a lot bigger).

When I run the first script, I get the correct result.

When I run the second script without running the first script, I get the correct result.

When I run the second script after running the first script (ie: with both windows displayed), it creates a certificate for all the records ie: 2 of 12, 4 of 12 > 12 of 12.

I expected that to be fairly easy to debug but…

When I run the second script using the debugger (after running the first script), I get the correct result.

What really throws me is that, if I 'cancel' the incorrect preview (which deletes the certificates/records and closes the window), and run the same script again, I get the correct result.

What am I looking for? …how could one script get 2 results?

Posted

I've discovered what is happening but I don't understand why!

Both scripts find all records relating to a Job No (resulting in 6 records as described before). They then, by looping through, omit half each - the first script omitting even page numbers, the second omitting odd. Then it opens a new window switches to a related table/layout and creates the certificate, looping through the found set in the first window to create the three certificates.

Somehow, the second script has all three even page numbered certificates as soon as the new window/table/layout is chosen, without the 'New Record script step or any looping to create multiple certificates (the latter was simply duplicating a set of certificates).

I'm at a loss as to how this is happening.

Posted

FMP does not natively display "Page XX of YY" so a developer has created the functionality. Most probably the last page number is stored in a global field and it is set as part of the scripted preview process:

Enter preview mode

Go to last page

Set field: gLastPage = get( pageNumber )

Go to first page

In this case the problem is that there is only 1 global field, and it's being updated for the second preview while the first preview is still open.

Posted

You're right, that is causing the '12' when it should be '6'. But I still have the second script finding the certificates and page numbering them correctly before it runs through the loop in the script that is there to find that information. I suppose, as long as it gets the correct result, why should I worry!

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