Jump to content

Set Field in a Scripted Find


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

Recommended Posts

I may not have understood the problems that are similar and/or the solutions described, so forgive me if this is repetitive. I am using FM8 Advanced. I have a script that seems to work but it only works on one group of several identical groups, time after time after time. I am trying to produce a monthly summary report of attendance at several of our schools. I am using a Get(Scriptparameter) function with buttons so that any month can be printed whenever desired. The script is pretty standard except for the Find section. It reurns the correct result for one school and the same school repeatedly. What I want is the correct result for all the schools on the same report.

The find script section looks like this:

Enter Find Mode []

Set Field [AttendanceTO::gMonth; Get (ScriptParameter )

Set Field [ Case(AttendanceTO::gMonth = "A"; AttendanceTO::DateEnter <7/23/2005 and AttendanceTO::DateExit = "" ;

AttendanceTO::gMonth = "B"; AttendanceTO:}:( DateEnter <8/30/2005 and AttendanceTO::DateExit >7/23/2005;

(and so on for a total of 14 months)

Perform Find []

I have made sure that the "restore" capabilites of the Enter Find Mode and Perform Find are empty. I've made sure that all the records in the database are present. But everytime I run this script I get the monthly data for this one school on my report. The data is all summary data and is contained in a Summary Part on the Layout. It sure looks like I'm missing something here, aren't I?

Thanks for the help.

Link to comment
Share on other sites

The find script section looks like this:

Enter Find Mode []

Set Field [AttendanceTO::gMonth; Get (ScriptParameter )

Set Field [ Case(AttendanceTO::gMonth = "A"; AttendanceTO::DateEnter <7/23/2005 and AttendanceTO::DateExit = "" ;

AttendanceTO::gMonth = "B"; AttendanceTO:}:( DateEnter <8/30/2005 and AttendanceTO::DateExit >7/23/2005;

(and so on for a total of 14 months)

Perform Find []

This doesn't quite make sense. There's no need to set a global (gMonth) here, as you can access the script parameter at any time. But more importantly, the second Set Field[] does not have a target field set. Was this an oversight in transcription, or don't you have a target field set? Or perhaps the problem is with the date format in that calc. Remember, in calcs, literal dates should be referenced using the Date() function.

Link to comment
Share on other sites

If I am deciphering this correctly, you need to do something like:

Enter Find Mode []

# SET DATE ENTER CRITERIA

Set Field [ AttendanceTO::DateEnter ; Case ( Get (ScriptParameter ) = "A"; "<" & Date ( 7 ; 23 ; 2005 ) ; Get (ScriptParameter ) = "B"; "<" & Date ( 8 ; 30 ; 2005 ) ; ... (and so on for a total of 14 months) ]

# SET DATE EXIT CRITERIA

Set Field [ AttendanceTO::DateExit ; Case ( Get (ScriptParameter ) = "B"; ">" & Date ( 7 ; 23 ; 2005 ) ; ... (and so on for a total of 14 months) ]

#

Perform Find []

Link to comment
Share on other sites

Mr.s Comment & Ender

Thank you for your time and effort. I tried the calculation Mr. Comment provided and it worked on the nominal testing I've done so far, (other priorities you know). Ender you've helped me before and your comments always help me see the problems in a different way, which has always been to my benefit. Thank you both.

Link to comment
Share on other sites

Hi Veronica,

Are you in your Schools table? It sounds like it. But don't you want to summarize attendance? What is the table occurrence of your report? It sounds like you're in your school table searching your related attendance fields - I think your report should be in attendance which would produce all schools and not just one. :wink2:

Link to comment
Share on other sites

This topic is 5731 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
 Share

×
×
  • Create New...

Important Information

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