Skip 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.

Script to add current date to field, then bring up print preview

Featured Replies

  • Newbies

I'm customizing the pre-designed  Estimates database from Filemaker for a client and trying to modify the existing print script to add the current date to a field so they know when it was printed. 

When on a layout called PO Details, there are static infos there and there is a portal for multiple line items. Clicking on the Print PO button triggers a script that I'm trying to insert "Current Date" into a field AND open up a layout in a new window designed specifically for printing so that I can print the PO.

The problem is that the print preview window that pops up shows every line item from all records (related and unrelated to the PO I am trying to print) rather than only the one's that I want to print. It is adding the date to the correct record, however. 

Set Variable [ $id ; Value: POs Data::PO ID MATCH FIELD ]
Enter Find Mode [ pause; Off]
Go to Layout [original layout ; Animation: None]
Set Field [POs Data::PO ID MATCH FIELD ; "==" & $id]
Perform Find [ ]
Insert Current Date [Select ; POs::Date Invoiced]
Set Error Capture [On]
Freeze Window
Go to Related Record [Show only related records ; From table: "POs Data" ; Using layout: "Printable POs" (POs Data) ; New Window]
If [Get (LastError) /= 0]
Halt Script
End If
Sort Records [Restore ; With dialog: Off]
if [Get (SystemPlatform) = 3]
Freeze Window
Print [Restore: Select Your Printer ; With dialog : On]
Close Window [Current Window]
Else
Enter Preview Mode [Pause: Off]
End If

Edited by ClooSoo
clarification

I did not read your script (without seeing the context, it is rather meaningless). However, I noticed this:

42 minutes ago, ClooSoo said:

trying to modify the exiting print script to add the current date to a field so they know when it was printed. 

I believe this can be accomplished much more easily by inserting the current date symbol onto the layout - e.g.

Printed: {{CurrentDate}}

Note that this will change with every subsequent printing - unlike setting a field to the current date, which will remain stored. 

 

Edited by comment

  • Author
  • Newbies
41 minutes ago, comment said:

I believe this can be accomplished much more easily by inserting the current date symbol onto the layout - e.g.


Printed: {{CurrentDate}}

 

Appreciate the response... I'm not trying to add the CurrentDate to what I'm printing out. I want to add the date printed (or at least when the print preview window pops up) to an existing field in an existing record to be used for reference later. I added more to my post in order to clarify what I'm trying to do. 

Also, my bad. I accidentally typed "exiting print script" rather than "existing print script".

Edited by ClooSoo
clarification

I am afraid I still cannot find my way in your script. It seems much more complicated than I would expect. In any case, once you have located the PO you want to print and inserted the current date into one of its fields, doing:

Go to Related Record [Show only related records ; From table: "POs Data" ; Using layout: "Printable POs" (POs Data) ; New Window]

should isolate only the POs Data records that are children of the current PO.  You say that:

1 hour ago, ClooSoo said:

The problem is that the print preview window that pops up shows every line item from all records (related and unrelated to the PO I am trying to print) rather than only the one's that I want to print.

I can think of two possible explanations:

  1. You have selected the "Match all records in current found set" option in the GTRR script step;
  2. You are not on a layout of POs when you execute the GTRR script step.


Note that:

Go to Layout [original layout ; Animation: None]

doesn't do anything if you didn't leave the original layout. And we don't know what layout you are on when you call this script.

 

  • Author
  • Newbies
7 minutes ago, comment said:

Note that:


Go to Layout [original layout ; Animation: None]

 

Thank you! Simply removing this above line from my script appears to have done the trick. 

6 hours ago, ClooSoo said:

Thank you! Simply removing this above line from my script appears to have done the trick. 

Don't thank me. I said the step doesn't do anything - so removing it could not change anything. And I still believe that.

 

  • Author
  • Newbies

Well, believe what you want, but removing that step indeed makes the script perform as intended. 

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.