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.

Find Records and print them using a script

Featured Replies

Hi

 

I have a Social Car DB which matches clients with a volunteer car driver to take them to various appointments. All is working well but I have a problem that I'm struggling with. It concerns the searching of the DB and the users of the DB being able to find some specific records between a set of record numbers (serial ID's) and then print the found records using a script. I'll try to explain in more detail what it is I'm trying to do.

 

Every day new journeys are added to the DB Main Journey Form as clients phone or email the company and each journey consists of clients and their details, the destination where the client is going, times and dates and the driver and his details and given a journey reference number automatically using the serial number function. There are about 80 repeat journeys a week which are added and given the next sequential journey reference number. Each week I need to print these repeat records out as a batch and that are marked print "yes" and then give them to the various drivers so they can collect the client and take them to their destinations. 

 

So my problem is, how do I select that weeks repeats from the Main Journey Form say, from record number 200 to 295 but only print those records marked print YES and then do it all again the next week for the following weeks repeats from 395 to 455 marked YES and then display them on another form marked Printout ready for printing?

Solved by Jonah74

Go to solution

You should read the FileMaker Manual, Online Help, and then try following the instructions on how to create fields, scripts, perform finds, print found sets, etc.

 

You can also do a search of this Forum for your key words.

Using Google, try this

 

site: fmforums print found set

  • Author

Hi 

 

I know how to create fields, scripts and perform finds and I have read both the FM manual and the Filemaker Missing manual to see if I could find the answer before I posted here and I couldn't, hence me asking the question. I just need a little guidance on how to put it together.

If you can do this 'by hand' then you do it by script, because all a script is a remembered set of actions that you could do manually (at the simplest level).

 

Your script, in pseudo form should go something like this

 

1. Find the records you need

2. Go to your printing layout

3. Print the report

4. Go back to the original layout

 

You will need a layout that has the fields you need to search on and/or a layout for printing.

 

Translated, with real script steps

 

Go to layout (search layout)

Enter find mode with a pause, enter the search criteria, press enter (or click the continue button in the status bar)

Go to layout (printing layout)

Print

Go to layout (original layout)

  • Author

Hi 

 

Forgive me but I know how to create a script to print records (see the script below). The bit I'm trying to fathom out is how to get it to ask me for a record range (to - from, serial ID range) or a date range or anything else within a range and how to include this in the script.

 

 

Enter Find Mode [ ]

Set Field [ Journey::JourneyID ]

Set Field [ Journey::Print Status; "Yes" ]

Set Error Capture [ On ]

Perform Find [ ]

Go to Layout [ “Printout” (Journey) ]

Print [ Records being browsed; [ Restore: Deskjet 3050A J611 series [FE6C5E] ]

Show All Records

Any help would be greatly appreciated.

In it's simplest form

Enter Find Mode [ ] uncheck pause

Set Field Journey::Date; 1/1/2013...3/31/2013 ] 

Perform Find [ ] 

 

This would find all record with the date between Jan 1 and Mar 31 2013

 

There are several ways to write this range of data, for more information see

 

Finding ranges of information (See your online help or this LINK to the help too.

 

There are 2 different types of Finds.

 

AND & OR 

 

AND Finds = All criteria to be met are in a single Find Request (as you posted before)

Set all of the fields in a single find request.

 

Enter Find Mode [ ] uncheck pause

Set Field Journey::Date; 1/1/2013...3/31/2013 ] 
Set Field Journey::Print Status; "Yes" ] 
Set Field Journey::JourneyID; "6...12" ] 

Perform Find [ ] 

 

All criteria must be met or it will return the warning that no records met your find request.

 

OR Finds = Find any records that meet any of the search criterias

 

Note: Each criteria is on a separate New Record Request.

 

Using my example 

 

Enter Find Mode [ ] uncheck pause

Set Field Journey::Date; 1/1/2013...3/31/2013 ] 
New Record Request
Set Field Journey::Print Status; "Yes" ] 
New Record Request
Set Field Journey::JourneyID; "6...12" ] 

Perform Find [ ] 

 

This will find any record meeting any of the criteria.

 

HTH

Lee

 

  • Author

Hi Lee

 

Thanks for the info. Your second example is what I'm looking for but with user interaction where the script pauses and they put in the dates / record range they need for their particular printout. So how do I create your something like your second script that prompts the user to put in the date/ record range required rather than being 'hardcoded'   

See if this helps LINK

 

Here is a demo file by database pros LINK

  • 2 weeks later...
  • Author
  • Solution

Hi

 

After many hours of research, learning, blood sweat and tears and the help you provided I finally managed to understand how the global table and fields work and have created one that now does exactly what I wanted it to do. For anyone who is interested I thought I'd post it here as it may help someone in the future. This script asks the user to input the start and finish range (in my case its journey reference number but it could be anything you want it be from dates to ranges) and then the script goes away, looks at the range requested (plus all those records within the range marked print "Yes")  and then outputs them to another form ready for printing. Here's how I did it, whether its the right way or not I don't know but it works fine.

 

I first created a table called GlobalPrint and then created two fields in that global table. I then created a script called 'repeat prints' and selected the Show Custom Dialog, filling in the title and desired message. Then, from the Input Fields Tab I chose Specify and pointed this to the first field I had called gfirstrecord and the second input field to glastrecord in the Globals Printout table, naming the labels First a and Last record. Then I set up the rest of the script as shown below:

 

Print: Repeat Prints

Show Custom Dialog [ Title: "Request Records"; Message: "To print Repeat Journeys enter the Journey Reference Number required in the first search field and the last Journey Reference number in the second search field. "; 

Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No”; 

Input #1: GlobalPrint::gFirstrecord, "Enter First Journey Reference Number"; 

Input #2: GlobalPrint::gLastrecord, "Enter Last Journey Reference Number" ]

 

Enter Find Mode [ ]

Set Field [ Journey::Journey Ref; GlobalPrint::gFirstrecord & ".." & GlobalPrint::gLastrecord ]

Set Field [ Journey::Print Status; "Yes" ]

Set Error Capture [ On ]

Perform Find [ ]

Go to Layout [ “Printout” (Journey)

 

I suppose if I really wanted to be clever I could have inserted a variable into the input field of the custom dialog box whereby it would ask the user for journey ID or date range but hey, that's for another day when I've learnt how to use variables!! There may be another way or an easier method but in the meantime this script will work for anyone who need to ask users for ranges they will just need to rename the specific fields to their desired name.

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.