Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Creation Date / Report Print Date 1

Status
Not open for further replies.

cmc2000

Programmer
May 14, 2003
20
0
0
US
I have filmaker pro 5.5 database created and I have reports (letters) that i have merged with the records. I have a field in the form for the date the letter is mailed. How do I get a field on the letter itlsef of when the letter is created or printed and reference that back to the form. I need to be able to search database by date letter was created/printed.

Thanks
Brandon
 
I would think a simple way to accomplish this would be with the print script that prints the letter. One of the first items in the script would be to post to your date field todays date.

To first answer the question of the date showing on the form layout and the letter layout. The form layout and the letter layout can both have the same field on them.

Create a Print Date field formated as a text date field. This may be put on the form and on the letter.

In your print script, update the date field as follows.

SET FIELD(Print Date,DateToText(Date( Month(Today) , Day(Today) , Year(Today) ))

This will produce today's date and post it to your letter and form.

Now if your merged form letter is a calculated text field, you can include the Print Date field in your form calculation to include the date.

I hope this is what you were looking for.

Marty
 
Ok, I got that, I created a field called print date and formated it as text date, and placed it on the form and the form letter. I didn't understand where and how to put this SET FIELD(Print Date,DateToText(Date( Month(Today) , Day(Today) , Year(Today) )) into my print script? What do you mean by that. I have the form letter layout and a script that calls the layout, what should the script look like to get that date to post when the form is printed/created and have that date post to form as well.

Thanks
 
I made an assumption that you were using a print script to print your letter and the one line of code given abovewould have been added to your existing print script.

I don't think I have enough information on your solution to know exactly what to recommend, but I'll give it a try.

If I was building the solution, navigation to the letter would never be required. The form view should suffice for any required input. Taking the user to the actual print out and having them edit anything on the print out wouldn't be cool in my book.

So some place I would have a button to print my letter. Attached to that button would be a script. The script would look something like this:

User Abort Off
Error Capture On
Enter Browse Mode
SET FIELD(Print Date,DateToText(Date( Month(Today) , Day(Today) , Year(Today) ))
Go TO Layout[Letter}
Enter Preview Mode
Print[no dialog]
Enter Browse Mode
Go To Layout[form page]

If you are new to scripts, I want to point out that you always go to preview mode, then print for a letter or report. If you are starting this script with a button placed on your form page, FM will go the print letter layout, switch to preview mode, print the document, switch back to browse mode and back to your form page without the user being aware that anything happened except the letter printed. In other words, the screen stays on the form page the whole time. It doesn't have to be this way, but know that it's an option you have. If for example you would like to show the user the letter, you can place another line of code in the print script like this:

Show Dialog[Would you like to print this letter?, Yes, No]

If(Status[Current Message] = "Yes"
Print[no dialog]
end if


Based on your comments, it also sounds like you may be lost on how to create a SET FIELD in the script. So here is a little more detail if you need it. Here is an easier formula.

Select Scripts, then Scriptmaker
Create a new script or choose an existing script,
select edit,
on the left hand function list, scroll down and select
SET FIELD [] option listed on the bottom part of your screen is field and specify. Press field and select the field you wish to contain your static date.
Next click on specify. A calculation window opens up and you need to fill in the date calculation here.
From the top right of the dialog box, select view, from the drop down menu, date functions. Now all of the date functions are listed.
First select DateToText ( date ). Where the word 'date' is, this is a prompt from FM telling you where to put your next function.
So highlight the word date with your mouse, go back up to the date function list again and select:
Today

Your date function is complete and should look like this:

DateToText ( Today ). A little simpler than above.

Since we are learning FM here, the formula above works exactly the same except you can have the flexiblilty to add 14 days to your date function. It would look like this:

SET FIELD(Print Date,DateToText(Date( Month(Today) , Day(Today)+14 , Year(Today) )).

Add one month to todays date like this:
SET FIELD(Print Date,DateToText(Date( Month(Today)+1 , Day(Today) , Year(Today) ))

What we did different here is where the word 'date' was, we put together several function to add together the date. Playing with this will help you better learn all of the functions and how to manipulate them.

One more point of clarification. You mentioned post the date to the form as well. Understand that you can have the field date on as many forms and screens as you would like. When you use the set field option, the value is set into the field and will show up everywhere the field is placed. You do not have to go to every layout and paste or set field on every screen.

If this is what you were thinking, this may have come from any use of copy and paste functions. To copy a value from a field, the field has to be on the current layout. Then to paste that value to another field, you have to go to a layout where the field is accessible to be able to paste it.

Set field I like be cause the field can be formated to not allow entry by the user. This is a good option for your date problem. Allowing the user to tab into or place their cursor into the field allows them to edit the mail date. Having a script do the set field updates the field even though it is set to not allow the user access. This keeps the integity of the date field in tact.

I hope this novel helps you.

Marty
 
Thanks, that was perfect, exactly what I needed, You are a life saver. One more question, i was formatting the script to ask the question "would you like to print this letter"
I couldn't find the Show Dialog, so I used
Show Message[ "Would You Like to Print This Letter"]
If(status[status flag] what do i put in status flag to call the message above?

Thanks
 
Sorry, I'm using FM 6.0 Developer and it has both a dialog function and a Show Message.

The Show Message dialog has a button caption text for a 1st 2nd 3rd button. You may enter any text you want here. If text is entered, the button appears in your dialog box.

The if statement is inserted immediately following the Show message statement. You are saying if the user pressed button one, do this, if button 2 do this. What the caption text is has no relevence to the if statement. Go to your function dialog box and find Status ( CurrentMessageChoice ). Select this and format it as follows:


If(Status ( CurrentMessageChoice )=1
go to layout function
Enter Preview Mode
Print[no dialog]
end if


Else //(note: with 2 buttons an else statement is not needed. If button 2 was select the if statement for printing is false and you script will continue without printing. If three buttons were selected, you could have an else statement for button 2.

The other obvious choice is identifying a Status ( CurrentMessageChoice ) = 2
Then do this
Status ( CurrentMessageChoice ) = 3
Then do this.

I hoep this helps!

Marty
 
That was perfect. Thanks for your help. Another question popped into my little head. How can i make reminders to call clients back based on when a date expires, or becomes 10 days old from the original date. Can i make something to where a message comes up whe FM is loaded? Thanks for your help in advance
 
There could be many solutions to do this. Scripting can do just about anything if you can write the script. A startup script could look at every record in your database and print a follow up report based on call back status.

You could define one or more FIND buttons. I say define because when you do a find, the program is looking for a match based on you data entry. But if you further define a find selecting >= your date, then a script could be written to fill in todays date as the find request and specify the field to search as your follow up field and that if today date is equal to or greater than the follow up date, then return the record in the find.

So the way this would look is this. Say you have 100 records in your database, if you do a find for a match of todays date in the follow up field, the find will search every record for a match. Now the number of record found will likely show at like 12 or what ever the number was. So to make follow up calls you could scroll each record and make your follow up calls being careful to not change the follow up status unless contact was made. In that case you would enter a new follow up date. Other wise the follow up date stays the same allowing for this record to show up in a FIND request each time until you change the follow up date.

I think this is the easiest way. Make a field called Follow Up. When you make any entry in the record, you would enter the date to follow up. Write a script using that does a Find[Follow Up,>=Date(today)] and all records will show that conform to that find.

I want to mention that a list view could help this work better for you. If you don't know much about them, you should learn this. The list view will list each record in your database as if in a table. On the list view, put the fields that are primary like the company name, client name, follow up date. When you do the find from the list view then the results will allow you to see each person you need to follow up with in a table. Click on the row and you can review the details of that row. Select list view and go back to your found set. I'm not sure this is making any ssence to you. If you this interest you and but you feel lost, go to to see the filemaker solution I've put togther. You can down load this at This will work as a demo but you must enter a value for the company name and address, so just make something up. This solution may give you some navigation and sorting ideas. Go to Flyer or Finance tab on the left. The first screen you come to is a list view though there is only one item on the list. Select NEW and add a new file. Click on list view tab and details tab is what I'm trying to show you.

I hope this was some help to you!

Marty
 
I was a bit confused by the last post. I am using FM 5.5 and i tried to create the script to look up the follow up date = current date when FM starts and goes to list view. I can't find that command in the script menu in FM 5.5 to let me input that formula. Could you please help?

Thanks
 
The script does really say date = current date. You won't find that. To accomplish this you need to write a startup script that goes to the layout you would like to perform a find on. The manually perform a find using the browse, layout, find, preview button on your bottom left of your screen. Also make sure your side bar, the cardex navigation is open. Perform the find and notice on the side bar click on symbols. Choose the greater than or equal to symbol, go to your follow up date field and enter today's date. Press the enter key. Now go to script maker and begin to create your script. Select from the functions PERFORM FIND, play with it but I think you want constrained set, and when you click OK, you will have a dialog pop up asking if you want to keep or replace. We want to select replace. Now the Perform Find is going to search for equal to or greater than by itself.

Find this in a book. I own a few of them and it's not there!

Ok I've played with this and have choose to leave all of the above because you may find it useful. However, I need to modify this for you solution. All of the above works perfect except the date will change everyday and this script will not allow the user to input the date.

So I've tested this and it works for me.

Script it using the function
Go to layout: List View (your layout name for the list view)
Enter FIND MODE
SET FIELD[Followup date, ">="&Date{Today, Today, Today}
Perform Find uncheck restore find request, select replace

I tested this with a text field so the above date formula you may need to verify.

I hope this clears it up for you.

Marty
 
thanks for your help marty, you have been great, ok ig ot the script working for the follow up list and it sends to a list view. I was wondering if it would not be too much trouble to seperate the list by alphabet, what i mean is can i have a script to look for last name starting with A-G, H-P, etc. and put those results into another list say Call Back category List?

thanks, is advance, I'm thinking if you interested, after i get this finished, i might just like to pay you to put something together for me

Brandon
 
There are no limits to your search. If you have several different combinations you would like to create, you need a different script for each. You could have a button on your layout A-H, connected to the A-H script. This could make more since than a script to run at startup.

At startup, you may be trying to look up a certain client's phone number and find that you have to wait for the script to run, then clear the find to locate your client to get the number.

On the other hand, you may find that it's about 10:30, I've got my morning work done, it's time to do followup calls. Press the A-H button and you are in business.

The script change would look something like this:

Script it using the function
Go to layout: List View (your layout name for the list view)
Enter FIND MODE
SET FIELD[Followup date, ">="&Date{Today, Today, Today}
SET FIELD[(Last Name, ">=A...H)]
Perform Find uncheck restore find request, select replace

Doing a find like this narrows the find to the date request and the Alpha request. The Symbol drop down to use between the A and the H is range. Range inputs ... between your caracters.

There is likely many other choices of how you could do this to make it user friendly and cool but it's hard to recommend much not seeing the interface and understanding how the user would use it.

I'm a mortgage loan officer by trade with a nack at this stuff. I enjoy the problem solving. I got into FM to write a software program for loan officers. Ask-Max. If you want some consulation assistance let me know. marty@ask-max.net

I hope this helps!

Marty
 
Thanks for your help, so far so good, one question about a previous question, I got the print script for my letter setup correctly so that the setfield send date text to my print date field, however the problem I am having is that when i press on the prin letter button, it prints say 32 letters i have selected, but only send the print date to the 1st record. How can i make the date be sent to all the records i want to print letters for, i print like 50+ at a time, and need the date printed to the all records selected to be printed. Thanks for everything, also about the A..H, i am having trouble with that script as well.

 
There are a couple of ways to fix this. If you don't mind user intervention, select PRINT, and uncheck the without dialog option. Then when you print, the print dialog will show and the user can select from the drop down menu current record only as opposed to all records which is what is currently happening.

The second option is to put in your print dialog a go to related field function and set a self related relationship.

Relationship would look like this:

Database:Client ID::Database:Client ID

Your script would say go to all the files related to client ID:XXX. This should always be one file. The one record you are working on. Then no dialog is required to print only one record. This way will undo so to speak any current find that you have in place.

I hope this helps you.

Marty
 
User Abort Off
Error Capture On
Enter Browse Mode
SET FIELD(Letter 1,DateToText(Date( Month(Today) , Day(Today) , Year(Today) ))
Go TO Layout["Collection Letter 1"}
Enter Preview Mode
Print[no dialog]
Enter Browse Mode
Go To Layout[form page]

This is what my print script looks like
what do you think.
 
It's only sendind the print date to the one record i happen to be on at the time of pressing the print letter button, and not all the records that were selected in the find.
 
OK I didn't think of setting the date on multiple records for printing. The way this needs to be done is each record is update and printed individually. This complicates the script quite a bit.

you will need to add some fields. Add:

Start, global
Next, global

Script:
user abort on (for testing, you want to be able to stop the looping if you've made a mistake.
Error Capture On
Go to first record
Set Field(Start, Status(current record number)
Set Field( Next, Start + 1)
Enter Browse Mode
Loop
SET FIELD(Letter 1,DateToText(Date( Month(Today) , Day(Today) , Year(Today) ))
Go TO Layout["Collection Letter 1"}
Enter Preview Mode
Print[no dialog]
Enter Browse Mode
exit loop if(Next > Status(currentfoundcount)
Go To Record(Next) Select the right option based on field value - next is a field
Set Field(Next, Next + 1)
end loop
Go To Layout[form page]


Status(currentfoundcount) is a function from your top right drop down menu when in a calculation window. It returns the value or number of current found records. When Next is larger in value, this means we are out of records to go to so the loop exits.

This needs tweeking but it's a start. The Next field is counting the record number so the script knows which record to go to next and if it's time to exit the loop or not. The script is saying that if the currentfoundcount or the number of found records cannot exceed Next + 1. So when Next + 1 exceed the number of found records, exit the loop.

I noticed in my solution I had to use a self joined relationship to get the right print out. My solution is likely more complex and could have been part of the problem I ran into doing this same senario. Just watch out for it

Marty
 
Thanks, I put the print command on the outside of the loop so it sends the date first and then prints. It works perfectly. Thanks a million, you have made my life a whole lot easier. I have one more question. I have a container firled where i import check images into the database. Well i scan these checks first, i'm scanning a few 100 checks at a time, and instead of having to manually go to the form and insert each image into each record, can i write a script to insert a specific filename, if the file name lets say is always the persons lastname + Drivers license (8digits). Thanks for any insight. The thing about the name is that some people have a last name like De los santos, in which case is would need to have no spaces if possible.
 
You can create a calculation field with the result being a container. I would think if you are in the collection business and wanting to track this stuff, you would also have many check from one client for the same bill or for several bills. I'd suggest a seperate datebase for the checks. Hook the check database to the client database with a portal. The portal would be the calculated container field and only related to the client your are viewing. What this would do for you is allow unlimited checks from any one client. Open up the client file and all of the checks they have written your would be scrollable and viewable inside their client file.

Back to the calculation. You could device a filename sceam based on the clients name and the check number. This would alway give you a unique file name when scanning these in. All of the checks would scan into the same location and folder. The check database could have serveral calculations in place by default. If the check exist, it would automatically show up in your database. If it didn't the field would be blank.

I can think of several ways to do this. The user scans the check and then goes to the file and enters a filename for the check.

The calculation ore-set could do this automatically, but what if the person scanning misnames a file, then it would "add up" and would not show up.

I just thought of something that may work based on the calculation. You scan the check creating a pattern like you mentioned and the check number is alway your last digits. Then as a matter of bookkeeping, the user needs to note the check came in in the file. Have a check number 1 field, the user would enter the check number, the date, etc, and the calculation field for this check would automatically be created based on these entries. The last name, first 3 initials, last 4 of their social plus the check number. Once the check comes in, the file name path is completed and the check is pulled into the container.

I'm sure this would need some teeking, but it a concept to start with.

I don't think you need a script for this.

I hope this helps.

Marty
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top