Jump to content

how do I write a simple find script?


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

Recommended Posts

I am having difficulty writing what I thought was a simple find script. I am using a single database to keep track of our widgets. We have two different types of widgets, incoming widgets and outgoing widgets and all of the widgets have a unique name.

I have assigned one field (NAME) to contain the unique names of the widgets and one field (WHOM) to contain to whom the widget was sent (if it is incoming I enter "us" in that field if it is outgoing I enter "Joe" or "Acme Corp." or "The Andersons" etc).

I would like to create a script that performs a find in the NAME field that first filters out all of the "us" widgets from the WHOM field.

I would also like to create a script that performs a find in the NAME field that first filters out everything EXCEPT for the "us" widgets from the WHOM field.

Please keep in mind if/when you respond I don't know the FIRST thing about writing a FM script. I clicked away in the script manager and tried many variations. I've read a good bit of The Missing Manual but I still have almost no idea what most of any of it means.

Link to comment
Share on other sites

To take a current found set of names and then you want to constrain it by a script in which the Whom field is "us":

Enter Find Mode

Set Field [ Whom; "us" ]

Constrain Found Set

To take a current found set of names and then you want to constrain it by a script in which the Whom field is NOT "us":

Enter Find Mode

Set Field [ Whom; "us" ]

Omit Record

Constrain Found Set

Link to comment
Share on other sites

Whoops! I spoke too soon. The first script in which the Whom field is "us" I get one of two results. If I remove the pause in the Enter Find Mode step then I cannot enter the Name of the widget and the script found set is every single widget sent to "us". If I remove the pause in the Enter Find Mode step it allows me to enter the name of the widget but I will get a warning saying "no records match this set" even though there are records that match that set.

Link to comment
Share on other sites

Based on your first post, I thought that you would be manually searching for a widget, returning a found set, and then hitting a button to constrain the set to only those in the US or not in the US.

Link to comment
Share on other sites

Sorry I should have explained myself better.

I would like to write a script so that when I click a button a situation is created where I can input the name of the widget to be found and the script will automatically cull it's finding(s) from the US set.

The other button would omit findings from the US set.

I hope that's clearer. Thank you for your patience and help with this.

Link to comment
Share on other sites

Let say you have the following records.


ID	Name	Whom

1	John	us

2	Bob	us

3	Mary	them

4	Kelly	us

5	Rob	us

6	John	other

7	John	us

8	Cindy	them

9	John	them







First one:



Enter Find Mode [Pause]   // Enter manual criteria "John"

Set Field [ Whom; "us" ]

Perform Find []



Will return



1	John	us

7	John	us









Second One:



Enter Find Mode [Pause]   // Enter manual criteria "John"

New Record/Request

Set Field [ Whom; "us" ]

Omit Record

Perform Find []





Will return



6	John	other

9	John	them

Link to comment
Share on other sites

  • 3 months later...

Thanks for your post mr_vodka. I have been wondering how to do omit case for ages. I am no newb but didn't put together the idea of running the omit step before the find step. I was always thinking it would be a check box on the find step and that this was some fm blind spot or something!

Thanks again.

Michael

Link to comment
Share on other sites

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