Jump to content

Find fields BEGINNING with particular letter ONLY


ccb
 Share

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

Recommended Posts

  • Newbies

This seems silly that I have to post for this answer, but I'm going crazy. I have a database of company records, and I want to find companies that BEGIN with letter "A". Like "Acme Brick","American Financial",etc. NOT "Jim's Heating & Air" nor "Bob's Alley".

How can you do this in find mode and/or in a script? Below is an section of my script that doesn't seem to do the trick. HELP!

Enter Find Mode

Set Field [ Company, "A*" ]

Perform Find

Go to Record/Request/Page[ First ]

Loop

If [ not Left(LeftWords(Company, 1),1) = "A" ]

Omit Record

End If

Exit Loop If [ Status(CurrentRecordNumber) = Status(CurrentFoundCount) ]

Go to Record/Request/Page[ Next ]

End Loop

Link to comment
Share on other sites

The only way you have to find records beginning with a particular letter,without scripting and without forcing user to pick symbols from search palette, involves these steps:

  • create a calculated field (stored) in which you store the capitalized initial letter of the field in which you need perform the search (suppose LastName field).

    Automatically FM will calculate this for each rec. in your DB.

    Have this calculated field on your current layout or, better, in a search dedicated layout.

  • Enter find mode and fill this field with the letter (capitalized) you want to search for, then perform the search.

    On a fly you will have displayed all records (if any) beginning with the searched letter.

This trick is a good start point for building complex partial searches.

Have nice job & regards.

[ September 11, 2001: Message edited by: JPaul ]

showtopic.php.zip

Link to comment
Share on other sites

quote:

Originally posted by JPaul:

The only way you have to find records beginning with a particular letter,without scripting and without forcing user to pick symbols from search palette, involves these steps:

This is correct and is a good way to do this kind of functionality.

Although most often you should use scripts for your finds anyway, and I am not sure that creating and searching on calculated fields is a better solution.

Link to comment
Share on other sites

  • 5 years later...

Let's take this to the next level.

What if I create a layout with only buttons, one for each letter. I want the use just to clikc the letter by which they want to search.

I thought about using the script parameter and set the letter as a script parameter for each button. But have not found a way on how to use it within a script for the search.

A find won't allow me to specify the function get(scriptparameter) or a storage calculated field (global).

Any ideas?

Link to comment
Share on other sites

If you have a button for each letter that passes a script parameter of the letter than:

Enter Find Mode []

Set Field [ Company, "==" & Get ( ScriptParameter ) & "*" ]

Perform Find []

Link to comment
Share on other sites

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