Is the "other layout" based on the same table or another table?
Each layout you have in your database refers to a table occurrence. This is one of the "boxes" shown in Manage | Database | Relationships. You specify a table occurrence for a layout by selecting it in the show records from drop down that first appears in the new layout wizard and also in the layout setup dialog.
Now the key explanation on how your sort order is getting changed: If both layouts refer to the same table occurrence, they share the same found set and sort order. What you do with the found set on one layout affects what you see on the other. This is often a very useful feature in filemaker, but in your case it sounds like you want the found set on your home layout to remain unchanged even when you change to the other layout, perform a find, sort in a different order, omit records, etc on it and then return.
There are several ways to deal with this challenge:
1) Create a script that produces the found set and sort order that you want. This can be as simple as Show All Records followsed by a sort step. Run this script to restore the found set when you return to your home layout. The OnLayoutEnter script trigger is one way to do this.
2) Go to Manage | Database | Relationships, find the table occurrence for your home layout. Select it and duplicate it by clicking the duplicate button. (Button with two plus signs.) Click Ok to leave manage | Databasel Go to your other layout. Enter layout mode. Select layout setup... from the layout menu and change Show Records From to select the new table occurrence you just created. Now double click each field on your layout and respecify them to come from the new table occurrence. Any portals on this layout will need to be updated as well (You'll have to edit you relationships to make this work here.) Any scripts that refer to items on the layout may also need to be updated.
3) open a new window and go to your other layout in this new window. Each window you open in fileMaker also opens up a new set of found sets for each table occurrence in your database so any found set manipulation you do in the window won't affect found sets in the original window.
Thanks for your post. The layouts that change(unsort) the sort on my home layout are from different tables.
Here is what i am going to try: On the home button in the "other layout" i am goint to set it to " perform script" rather "go to layout".
This is the script i am planning to have:
go to layout["home"(table name)]
set error capture [on]
allow user abort[off]
sort records[restore; no dialog]
go to record/request/page[first]
Do you think this step will fix my issue?
If they are based on different tables then this issue should not arise in the first place. Actions on a layout based on a different table or in a different window should not affect the sort order of the original layout.
I might be wrong then, because I know for some of the fields are from different table where record id might be coming from the same table. My mistake. Do you think script above looks right? Thanks
It will resort the records. If different records have been found and/or omitted from the other layout. This script will not rectify those changes.
Here's how you can check your layouts to determine on what table occurrences they are based:
On each layout, enter layout mode and look in the status area for a pencil icon right next to the drop down list of layouts. If you see the same name here with both layouts, then they are based on the same table occurrence.
This script might restore your original found set more reliably, but it assumes that the original found set consisted of all records in the database:
Show All Records
Sort [no dialog ; Restore ]
(no need for set error capture here and you can include allow user abort if you want to, but this script may be fast enough that a user can't abort it before it completes anyway.
I tried the script and seems to be doing the job. And yes the layouts are from the same table as you said.
Thanks for help and if i need more information i will definitely come back.