Jump to content

Keeping found set when changing to related file


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

Recommended Posts

Hello All,

I have a relational database with a form and a find layout in file1 and a list form in file2. After performing a find using the find layout in file1, I want to switch to the list layout in file2 but only display the found records.

Can anyone help me on this one?

Greetings, Eric

Link to comment
Share on other sites

quote:

Originally posted by erc:

Hello All,

I have a relational database with a form and a find layout in file1 and a list form in file2. After performing a find using the find layout in file1, I want to switch to the list layout in file2 but only display the found records.

Can anyone help me on this one?

Greetings, Eric

In the script that takes the user from the first database to the related database, include a script step:

Go to Related Records [ Show only related records]

Perform Script [ Sub-scripts, External: "file 2" (a script to take the user to the list layout) ]

This will do what you want.

Chuck

Link to comment
Share on other sites

Depending upon the relationship, the Goto Related Records script step may not do what you want. Assume one record in File1 relates to multiple records in File2 by a File1 Record # and you have a found set of records in File1. The Goto Related Record (show only related records) script step will only show the related records in File2 for the record you are currently on, NOT for the entire found set.

To show all the related records in File2 for the found set in File1 (in this example related by File1 record#), create a global text field for the left side of the relationship, enter all the File1 records numbers from the found set into this field separated by carriage returns, and then perform the Goto Related Records (show only related records) script step. The global field can be filled with a looping script or by creating a list view with only the record number field (no labels, no graphics, etc.) and performing a copy all script step followed by a paste tothe global field.

-bd

[This message has been edited by LiveOak (edited September 14, 2000).]

Link to comment
Share on other sites

quote:

Originally posted by LiveOak:

Depending upon the relationship, the Goto Related Records script step may not do what you want. Assume one record in File1 relates to multiple records in File2 by a File1 Record # and you have a found set of records in File1. The Goto Related Record (show only related records) script step will only show the related records in File2 for the record you are currently on, NOT for the entire found set.

To show all the related records in File2 for the found set in File1 (in this example related by File1 record#), create a global text field for the left side of the relationship, enter all the File1 records numbers from the found set into this field separated by carriage returns, and then perform the Goto Related Records (show only related records) script step. The global field can be filled with a looping script or by creating a list view with only the record number field (no labels, no graphics, etc.) and performing a copy all script step followed by a paste tothe global field.

-bd

[This message has been edited by LiveOak (edited September 14, 2000).]

Sorry about that. I misunderstood the question. The best way to find all records related to all records in the found set is just the above technique.

Chuck

Link to comment
Share on other sites

quote:

Originally posted by erc:

Can you give me an example of a script and how to set up the global field. In other words, I need more details because I'm new to Filemaker. Thanks...

Greetings, Eric

Go into Define Fields and type in the name of a new field. I'll call mine gCurrentIDs. Before you click "Create", click the radio button for global. When you click "Create" choose text as the type of global field.

Create a new relationship, almost identical to the relationship you have for these two files, in that the file and the right hand field are going to be the same. The left hand field, however, will be the global field you just created. I'll call my relationship "Global" for the script below.

Create a new layout in your database which has only the ID field that the relationship is based on. Never put any other fields on this layout. I'm going to call it "ID List"

If you don't have a developer layout, create one, and place the global field on it. I'll call mine "Developer" for the script below.

Create a script that is run _after_ you have your found set:

Go to Layout [ ID List ]

Copy All Records

Go to Layout [ Developer ]

Paste [ Select/perform, gCurrentIDs ]

Go to Related Record [ Show only related records, Global ]

Link to comment
Share on other sites

quote:

Originally posted by erc:

Hello,

Thanks... I have it working now.

One question. On the ID List layout, only the key field is allowed, but on the Developer layout other fields ar also allowed. Is that correct?

Greetings, Eric

That's correct. The reason is that the Copy All Records command copies all the fields on the layout for all the records in the found set, using returns to separate the records. We only want to copy the ID field, so we don't ever want to place any other fields on this layout.

To paste the information we just copied, we just need to have the field on the current layout. The Developer layout is good for this, as it's a common place to put developer related fields, which our global is. Once you've pasted the information into the global field, you don't need to stay on that layout.

Chuck

Link to comment
Share on other sites

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