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

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

Recommended Posts

Posted

FM8.5

I have a script that allows me to create a pdf of a record and attach it to an email, as follows:

Go to layout [invoices]

Print setup

Show Custom dialog ["Invoice PDF Option" ; Create PDF of this message (Current) or all Messages (Being Browsed)"]

If [Get (LastMessageChoice ) = 1]

Save Records as PDF [Restore; No dialog; Current record]

Else If [Get (LastMessageChoice ) = 2]

.....

Else If

End If

Send Mail [send via E-Mail Client: Contact::Email: Subject :Invoice

Exit Script

Enter Browse Mode

See attachment for a detailed jpeg.

I want to be able to loop this script to enable me to send an email to a found set. In this case the found set is; Status Order ="shipped" and Status Payment = "" . "" here means status payment has no value - which I might have wrong. Once I have created this pdf email the status changes to "Invoiced".

The caution - I want separate PDFs and not a PDF of all the 'records being browsed' .

Can any one help? Does this require the loop function?

THanks

BuckBuck

Posted

I do things like this in 2 steps: first, make it work for the current record -- what you have done. Then create a script that processes the found set. In pseudo code (and omitting lot of error checking):

Go to record [ first ]

Loop

Perform script [ the current record script ]

go to record { next, exit after last ]

End loop

Note that the last go to record [ next ] step has the "exit after last" option selected. This allows the loop to be exited after the last record in the found set is processed. Without this option the loop will be infinite.

If you are not experienced with using loops, always save a backup copy of the file BEFORE running the script because if the loop goes infinite you may have to force quite FMP and this could damage the file.

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