Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I have all the other portions of my script working except for (what I think should be) the easiest.

- In the parent script the user enters a year in a dialogue box (Let's say "2005")

- It gets passed to the child script- (I know this works, because the rest of the script works and hinges upon that working).

- What I want to do here is perform a find on the "f_year" field based on the parameter passed to my script, then delete all the records.

So what I thought I'd do is:

1 SetField[f_year, Get(ScriptParameter)]

2 Perform Find[]

3 Delete All Records []

Seems pretty straight forward- however when it gets to the find step it can't find anything =/.

I've tried omitting line 1, and tried to just use line 2 and 3, trying to set critera for my find- however, I cannot seem to evalute the value in a field within that box (I really have no idea what the criteria are supposed to be used for aside from performing finds with explicit arguements.)

Hopefully this won't be too much of a brain buster for you guys...

Posted

In order to do your search in a script, you have to put Filemaker into Find Mode explicitly. It's not clear in your post whether you are, in fact, putting Filemaker into Find mode *before* the steps you have listed. So, line .1 should be:

.1 Enter Find Mode[]

Then, your script will put the year into the search criteria and find them. As you have it, the SetField step is changing your record first, and then finding.

Posted

Ok, another find problem:

If FM happens to find no records after doing a scripted find, how do I get it to continue without telling the user "No Records match this set of find requests" (because there are no records period)

Currently I'm cheating it by creating a dummy record to ensure that SOME record that matches must exist. Then it finds at least one, and deletes it.

Seems kinda cludgey... a better way?

Code looks like:

1 Enter Browse Mode

2 NewRecord Request

3 SetField[field to be seached, matching value to be deleted]

4 Enter Find Mode

5 ... (code from above) ...

Posted

The "dummy record" trick went out with FMP 3.0.

Instead use the Set Error Capture [on] script step. It suppresses the FMP error messages. However it also means that the script must trap for errors and take the appropriate action.

Set Error Capture [on]

Perform Find []

If [ Get ( FoundCount ) = 0 ]

Else

End If

Posted

Works like a champ!

(As long as you add in the desired action for use after the else.)

Thanks again! I'm sure I'll have more questions.

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