Jump to content

Script leaves me stuck in Find Mode


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

Recommended Posts

I have a little script to find student records. Unfortunately, when the script runs, the “cancel” or “continue” buttons in the status area must be clicked before anything else can happen.

I obviously don’t understand what is happening after the “Perform Find” step locates the record(s) and displays them in the layout scripted for either a single record of multiple records. I’ve tried some script steps like “Allow User Abort on/off” and “Exit Script” step but nothing works.

I don’t want to have to run this database with the Status Area open all the time – screen space is so limited that I covet that one inch on the left side! What am I doing wrong?

Here are the script steps:

Perform Find []

If [Get(FoundCount)>1]

Go to Layout ["Multiple Found Records" (Student_Data)]

View As [View as List]

Else

Go to Layout ["Student_Data (Student_Data)]

End If

Link to comment
Share on other sites

You haven't decided what to do if no records are found. You currently go to Student_Data. You need to also add a Set Error Capture [ On ] at the beginning and handle the error yourself. Try:

Set Error Capture [ On ]

Allow User Abort [ Off ]

Perform Find [ ]

If [ not Get (FoundCount ) ]

Show Message [ “No records found “ ]

Show All Records

Halt Script

End If

If [ Get (FoundCount ) = 1 ]

Go To Layout [ Student_Data (Student_Data)]

Else

Go To Layout [ Multiple Found Records (Student_Data) ]

End If

Also, I'm unsure why you have the 'View As List' because truly you should design each layout to only be displayed in one view type. So it should BE a list to begin with. So I didn't add it in my script because I just didn't have the heart to do it.

LaRetta

Edited by Guest
Added suggestion on View As List
Link to comment
Share on other sites

Thank you for your answers anad comments. I appreciate the "List View" point about getting layouts right from "the ground up," and have fixed that.

A couple of questions about your script:

I cannot find a "Show Message" script step, so substituted "Show Custom Dialog" instead.

Unfortunately, the new script (that custom dialog substitution) doesn't change the original problem.

It's weird, though. After I find the record(s), I can do most every function that is part of this layout (on a button that runs a script) on which the found record is displayed.

I am blocked from doing anything not accessible through the layout displaying the found record, and in fact the menus at the top of the screen are greyed out.

Worse yet, it all crashes to a stop if I use the layout's button to get my Print Menu page. I am able to print an envelope, but its script isn't able finish and that hangs up the whole program requiring a Force Quit since [color:red]nothing can be done thereafter.

I'm the point in adding functions to this database where the scripts are becoming more complex, increasing my potential for error. I would like to find reference material for study. I currently use the Que set "Using Filemaker 8" and "Filemaker 8 Functions and Scripts" set, plus "The Missing Manual" book. I also use the "Help" pages quite a bit, but more often than not, I just can't find what I'm looking for (like the different between "

Show Message" and "Show Custom Dialog" question).

Do you -- or others -- have any favorite books that would help me understand scripting better?

I appreciate the suggestions!

Link to comment
Share on other sites

To answer the first issue; yes, Show Custom Dialog replaces Show Message. I had copy/pasted a script from another of my posts (which was handy) and it was for vs. 6. I neglected to change that to current version.

I would have suspected you have your pause on with an Enter Find Mode [] step but even that won't explain why your menus are greyed out. You've stumped me. Maybe others have ideas or else you'll want to zip and attach your file. I'm sure we can help you figure it out.

I prefer using FM Forums for learning and, as for books, I like them all but haven't read a single one of them ... I can't read. :bigshades:

Link to comment
Share on other sites

Menu items greyed out ... by any chance did you put a Pause/Resume Script [ ] step in there by accident? The FM menu items aren't greyed out, but all items under the 'Manage' menu are greyed out automatically while it is running and ScriptMaker is greyed out as well. Just a thought ...

Link to comment
Share on other sites

You are brilliant!

Yes, I'd accidentally gotten a [Pause] step in there. I'd set it up on two buttons -- one scripted to go into find mode, which essentially gives me a layout with all the fields blank for the search. Then the scripted button we've been agonizing over, the Find Records one.

Well, the [Pause] was forgotten in the button to go into find mode.

Lesson learned -- and I can see why you said you'd rather use the FM Forums than a bunch of dry old books for solving problems!

Thanks! I owe you!

Link to comment
Share on other sites

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