Hi Richard and Jason,
The Production environment is at the School. They are running FM Server
running on a Win 2003 Server. Lan is a 802.11G WiFi. Desktop is a fairly
new Laptop running FM 9.
The test environment is a Virtual FM server (V9) and a Windows PC
running FM 9. Here I can "play" as much as I need to without messing up
the real data.
As scripts go this is fairly straight forward. The text of the script is
below.
In doing some additional research I believe the real issue is the
section that updates the static values for the report. All of the source
fields are calculations that are Unstored. So FM makes sure they are up
to date before the set field step completes.
I split the two sections out and timed them. The section that credits
merits for promptness takes from 12 to 20 seconds. The static field
update can take up to two minutes. The times vary somewhat from one run
to the next.
Again any suggestions that could speed this up would be appreciated.
Thanks very much to all for your help.
Bruce Herbach
------------------- Script -----------------
#This script goes through all of the students and awards
#1 Merits for each day a student arives at school on time.
#And then updates static records for the Weekly report.
#
Go to Layout [ “#104 Student Record view of static weekly report”
(Student_record) ]
Show All Records
Go to Record/Request/Page [ First ]
Freeze Window
Set Variable [ $Merit_Type; Value:"Excellence" ]
Loop
Set Variable [ $record; Value:Get ( RecordNumber ) ]
Set Variable [ $Name; Value:Student_record::LastFirst ]
Set Variable [ $Student_ID; Value:Student_record::StudentID ]
Set Variable [ $Student_Grade; Value:Student_record::Grade Level ]
Set Variable [ $lp_cnt; Value:Student_record::G_WK_Tardy +
Student_record::G_Wk_Absences ]
If [ DayOfWeek ( Get ( CurrentDate ) ) = 6 ]
Set Variable [ $date; Value:Get ( CurrentDate ) - 1 ]
Else
Set Variable [ $date; Value:Get ( CurrentDate ) ]
End If
Go to Layout [ “MERIT auto data entry form” (Merit) ]
Loop
# Create the merit records if earned.
Exit Loop If [ $lp_cnt ≥ Global_info::Days_in_week ]
New Record/Request
Set Field [ Merit::Student_ID; $Student_ID ]
Set Field [ Merit::Name; $Name ]
Set Field [ Merit::Grade; $Student_Grade ]
Set Field [ Merit::Merit Type; $Merit_type ]
Set Field [ Merit::Date; $date ]
Set Field [ Merit::Faculty; "System" ]
Commit Records/Requests
Set Variable [ $lp_cnt; Value:$lp_cnt + 1 ]
End Loop
#
# Now update the Static fields for the report
Go to Layout [ original layout ]
Go to Record/Request/Page [ $record ] [ No dialog ]
# Reward student for good behavior
If [ Student_record::G_Merits_wkly ≥ ( 4 * Global_info::Days_in_week) ]
Set Field [ Student_record::G_Purple_Shirt_cnt;
Student_record::G_Purple_Shirt_cnt + 1 ]
Set Field [ Student_record::St_wk_purple_shirt_tues; "Yes" ]
Else
Set Field [ Student_record::St_wk_purple_shirt_tues; "No" ]
End If
Set Field [ Student_record::St_wk_start_date;
Student_record::G_Friday_last ]
Set Field [ Student_record::St_wk_end_date;
Student_record::G_Thursday_Cur ]
Set Field [ Student_record::St_wk_Absences_for_week;
Student_record::G_Wk_Absences ]
Set Field [ Student_record::St_wk_Tardies_for_week;
Student_record::G_WK_Tardy ]
Set Field [ Student_record::St_wk_absences_ytd;
Student_record::G_Tot_Absences ]
Set Field [ Student_record::St_wk_merits_ytd;
Student_record::Total_Merits_YTD ]
Set Field [ Student_record::St_wk_demerits_ytd;
Student_record::Total_Demerits_YTD ]
Set Field [ Student_record::St_wk_merits_for_week;
Student_record::G_Merits_wkly ]
Set Field [ Student_record::St_wk_demerits_for_week;
Student_record::G_Demerits_wkly ]
Set Field [ Student_record::St_wk_purpose_for_week;
Student_record::G_M_Purpose_wkly ]
Set Field [ Student_record::St_wk_respect_for_week;
Student_record::G_M_Respect_wkly ]
Set Field [ Student_record::St_wk_integrity_for_week;
Student_record::G_M_Integrity_wkly ]
Set Field [ Student_record::St_wk_daring_for_week;
Student_record::G_M_Daring_wkly ]
Set Field [ Student_record::St_wk_excellence_for_week;
Student_record::G_M_Excellence_wkly ]
Set Field [ Student_record::St_wk_poor_team_for_week;
Student_record::G_D_Poor_Team_wkly ]
Set Field [ Student_record::St_wk_talking_for_week;
Student_record::G_D_Talking_wkly ]
Set Field [ Student_record::St_wk_Uniform_for_week;
Student_record::G_D_Uniform_wkly ]
Set Field [ Student_record::St_wk_disrespect_for_week;
Student_record::G_D_Disrespect_wkly ]
Set Field [ Student_record::St_wk_purple_shirt_cnt;
Student_record::G_Purple_Shirt_cnt ]
Set Field [ Student_record::St_wk_prefect_status;
Student_record::G_Prefect_Status ]
# Static Value for promptness has to be calculated based on days in week.
Set Field [ Student_record::St_wk_Promptness; Global_info::Days_in_week
- (Student_record::G_Wk_Absences +
Student_record::G_WK_Tardy) ]
Set Field [ Student_record::St_wk_Silent_lunch;
Student_record::G_Cons_Silent_Lunch_cnt ]
Set Field [ Student_record::St_wk_Loss_of_recess;
Student_record::G_Cons_Loss_of_recess_cnt ]
#Set the Weekly Faculty comment and then clear it for the next week.
Set Field [ Student_record::St_wk_Facult_comment;
Student_record::G_Wkly_Faculty_comment ]
Set Field [ Student_record::G_Wkly_Faculty_comment; "" ]
#The next two steps take care of the payrole for the week.
Set Field [ Student_record::St_wk_payday;
Student_record::Payrol_this_week ]
Set Field [ Student_record::Merit Dollars Spent;
Student_record::Payrol_YTD ]
Commit Records/Requests [ No dialog ]
Go to Record/Request/Page [ Next; Exit after last ]
End Loop
Richard S. Russell wrote:
On 2008 Feb 22, at 0:12, Bruce Herbach wrote:
In my test environment this cut processing time from over 3 minutes
to less then 2 minutes. When I ran the original version of the script
in the production environment today it took about 8 minutes to run. I
won't be able to run the updated version in production until next week.
Does anyone have any suggestions that would help improve performance
of a script of this nature?
By "production environment", do you mean that the files are stored on
Machine A and processed by a user on Machine B? (This is as opposed to
the "test environment", where presumably the files and program are on
the same computer as you, the tester.)
If so, how are A and B connected?
Are they in the same building?
Is FileMaker the foreground application on Machine A?
Are there multiple users in the production environment?
Are you using FileMaker Server?