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

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

Recommended Posts

  • Newbies
Posted

Hi Everyone!

I need help with a script that's just not performing. Basically, I have 13 fields that go as follows:

Last Name or Business

LNB2

LNB3

First Name I.

FNI2

FNI3

Accts

A2 - A7

Currently, if I wanted to find a particular account number I would have to do 7 finds, a find for ea. Acct number field. The same goes for a last name search, I would have to input the last name in the Last Name or Business, LBN2 & LBN3 fields to ensure that I have checked all fields.

What I wanted to do was create a "quick search", where all you would do is type in the information in one field (i.e. Smith) then click on a Quick Search button (to activate script) and it would automatically bring you to a record(s).

The script is set up this way: (it's long...)

Enter Find Mode []

Set Field ["Last Name or Business", "Last Name Business Acct"]

Set Field ["First Name I ", "First Name"]

New Record/Request

Set Field ["LNB 2", "Last Name Business Acct"]

Set Field ["FN1 2", "First Name"]

New Record/Request

Set Field ["LNB3", "Last Name Business Acct"]

Set Field ["FNI3", "First Name"]

New Record/Request

Set Field ("Account", "Last Name Business Acct"]

New Record/Request

Set Field ["A2", "Last Name Business Acct"]

New Record/Request

Set Field ["A3", "Last Name Business Acct"]

New Record/Request

Set Field ["A4", "Last Name Business Acct"]

New Record/Request

Set Field ("A5", "Last Name Business Acct"]

New Record/Request

Set Field ["AS", "Last Name Business Acct"]

New Record/Request

Set Field ["A7", "Last Name Business Acct"]

New Record/Request

Set Error Capture [On]

Perform Find []

Clear [select, "Last Name Business Acct"]

Clear [select, "First Name"]

Go to Layout [original layout]

The script will not search, it just brings me back to the record where I began the search. Does anyone have any ideas on what I'm missing?

Posted

You will need to store your find criteria in a global field first, before you do the scripted find you have shown. So, create a "Find" layout where the user types in the Last Name and First Name into 2 new global fields and then clicks on a Find button which runs your script and returns you to a layout you want.

You would need to modify your script so that once yo have entered the find mode, your set field commands would set the field with the contents of your global fields, like:

Enter Find Mode []

Set Field ["Last Name or Business", g_LastNameFor Find]

Set Field ["First Name I ", g_FirstNameForFind]

New Record/Request

Set Field ["LNB 2", g_LastNameFor Find]

Set Field ["FN1 2", g_FirstNameForFind]

etc

make sure you're on a layout where all the fields are visible.

Another way would be to concatenate all the name fields together with a space in between each one, like:

SuperName = Last Name of Business & " " & LNB1 & " " & LNB2 etc, etc

and then do your find on this field.

Posted

And here is a troubleshooting clue, or three.

One is when a scripted find does not work, manually go to the "Modify Last Find" and look at your db. You will see what has (or has not) been entered in the field(s).

Two is to Set ErrorCapture [On] and trap the error.

Three is to use Pause Resume Script [] after the first data insert (set field or whatever). When you see what is occurring there, you then move that code to follow the next insert, etc. When your script runs, you remove this line of code.

The most successful solutions are products of good design.

Posted

This should have been done with relational databases. A search should only ever need be done in one field.

  • Newbies
Posted

Hi RussBaker

First thanks for your response. I'm really a novice at filemaker.

I didn't create a new layout, what I did was within the current layout I recreated the two search fields and I made them Global Fields.

Then I went back to the original script and I added New Record/Request after every Set Field instead of every other i.e.

Original Script

Enter Find Mode []

Set Field ["Last Name or Business", "Last Name Business Acct"]

Set Field ["First Name I ", "First Name"]

New Script

Enter Find Mode []

Set Field ["Last Name or Business", "Last Name Business Acct"]

New Record/Request

Set Field ["First Name I ", "First Name"]

New Record/Request

The crazy thing is that now it half works meaning that the script will search the entire database for first names and account numbers and it will do a match...but it won't work for last name searches.

Some one else wrote a reply for trouble shooting which I followed:

a troubleshooting clue, or three.

One is when a scripted find does not work, manually go to the "Modify Last Find" and look at your db. You will see what has (or has not) been entered in the field(s).

Two is to Set ErrorCapture [On] and trap the error.

Three is to use Pause Resume Script [] after the first data insert (set field or whatever). When you see what is occurring there, you then move that code to follow the next insert, etc. When your script runs, you remove this line of code.

And what is happening is (now I'm not sure if this will make sense to you, but here goes) I type in Smith on the Last Name Business Acct Global Field. I click on the quick search button to run the script. It does nothing, it comes back to the first record on the database. When I trouble shoot I see that the name Smith appears in the Last Name or Business Field which is the field I want it to do a search on.

So I'm not really sure what's going on.

I was also wondering if you could give me a sample of this...you wrote

Another way would be to concatenate all the name fields together with a space in between each one, like:

SuperName = Last Name of Business & " " & LNB1 & " " & LNB2 etc, etc

How would this look in acutal script form like this?

Enter Find Mode []

Set Field ["Last Name or Business" & " " & LNB1 & " " & LNB2 , "Last Name Business Acct"]

New Record/Request

Anyway I hope I made sense.

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