Jump to content

multiple fields required for search


 Share

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

Recommended Posts

Script the Find process. It'll look something like this...

code:


Enter Find Mode [pause]

Perform Find []

In between these two steps you can perform checks to ensure that the find request has an entry...

code:


Enter Find Mode [pause]

If [isEmpty(Invoice Number) or IsEmpty(Zip)]

Beep

Show Message ["Enter an Invoice # or Zip code.", OK]

Enter Browse Mode []

Exit Script

End If

Perform Find []

...if the Invoice Number or Zip fields have no search criteria entered the script beeps, shows the message then exits the find process.

You could make it a bit nicer (and significantly more complicated) by making the script loop until a zip or invoice number is enetered into the find request. It'd look like this...

code:


Enter Find Mode [pause]

Loop

If [isEmpty(Invoice Number) or IsEmpty(Zip)]

Beep

Show Message ["Enter an Invoice # or Zip code.", OK]

Else

End Loop If [1]

End If

End Loop

Perform Find []

Of course, it'd be a good idea to give people a way to cancel out of the loop...

code:


Enter Find Mode [pause]

Loop

If [isEmpty(Invoice Number) or IsEmpty(Zip)]

Beep

Show Message ["Enter an Invoice # or Zip code.", OK, Cancel]

If [status(CurrentMessageChoice) = 2

Enter Browse Mode []

Exit Script

End If

Else

End Loop If [1]

End If

End Loop

Perform Find []

Link to comment
Share on other sites

Another approach is to have a 2nd layout ("search") from which to perform the find and which displays just the fields you want included. Write a script which is activated from a button.

Go to Layout ["search"]

Enter Find Mode [Pause]

If [isEmpty(Invoice Number) or IsEmpty(Zip)]

Beep

Show Message ["Enter an Invoice # or Zip code.", OK, Cancel]

Go To Layout ["search"]

Enter Find Mode [pause]

End If

<comment, format a button on the "search" layout to "resume script">

Perform Find []

If ["Status(CurrentError) = 401"]

Go to Layout []

<comment, you make a navigation choice if no records are found>

Else

If["Status(CurrentFoundCount) = 1"]

Go to Layout []

<comment, you make a navigation choice if only one record is found>

Else

If["Status(CurrentFoundCount) > 1"]

Go to Layout []

<comment, you make a navigation choice if more than one one record is found>

End If

End If

End If

[ March 20, 2002, 03:48 PM: Message edited by: Keith M. Davie ]

Link to comment
Share on other sites

quote:

Originally posted by mark:

Thanks Vaughan for your help!

In scripting this I find that I am not able to find End Loop If [ ] in my script options. I am on filemaker 5.0. Also I am getting automatic " " around any entry into the if and show message steps. Am I dim or what?

Thanks
crazy.gif

"Exit Loop If" is the script step that gets you out of a loop.

Regarding the quotation marks, don't worry about them; they show up in the script step to show you what the "If" statement or "Show Message" is.

Link to comment
Share on other sites

This topic is 7154 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

  • Who Viewed the Topic

    1 member has viewed this topic:
    Sharkenstein3D 
×
×
  • Create New...

Important Information

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