Jump to content
Sign in to follow this  
ccb

Find fields BEGINNING with particular letter ONLY

Recommended Posts

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

Share this post


Link to post
Share on other sites

Use the following: ==a*

This will find records which are EXACTLY (by the ==) the letter "a" followed by zero or more characters (by the *).

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites

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?

Share this post


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

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.