Jump to content
Sign in to follow this  
catskillmoccasins

multiple fields required for search

Recommended Posts

How do I require that 2 or more fields be filled in a search request. I am trying to secure customer records by requiring either invoice # and zip code or last name and zip code. I can not seem to find documentation of this kind of setting. Help? cool.gif

Share this post


Link to post
Share on other sites

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 []

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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 ]

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

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