Jump to content
Server Maintenance This Week. ×

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


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

Recommended Posts

  • 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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 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
Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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