11 Replies Latest reply on Jan 17, 2010 12:33 PM by comment_1

    New Window Issues

    thumper

      Title

      New Window Issues

      Post

      Ok im sure this is going to be really easy and i figured i would just ask instead of spending another week trying to do it on my own lol.

       

      so the situation is this, i got my main form page ("HP Main") with my records, on this page is a button to open a layout ("HP Main List View") using the same table but to display my records as a list (using only a few of the fields from that table). along side of each item in this list is a button that when clicked i would like it to close the current window ("HP Main List View") and then to get focus on the main  form window ("HP Main") and lastly to display the record chosen from ("HP Main List View")

       

      I have been pulling out my hair trying to figure this out for some time and im sure its just something silly that i forgot, if anyone could please help me out id appreciate it :D

       

      im using filemaker pro 9 adavanced, if that helps.

        • 1. Re: New Window Issues
          juancardona
             Attach to the button a script that sends the focus to the "related record", then closes the window (I recommend specifying its name)
          • 2. Re: New Window Issues
            thumper
               i think i understand, but i want the script to open the selected record from the HP Main List View layout in the other window that is already open using the HP Main layout.
            • 3. Re: New Window Issues
              comment_1
                

              thumper wrote:

               

              i would like it to close the current window ("HP Main List View") and then to get focus on the main  form window ("HP Main") and lastly to display the record chosen from ("HP Main List View")


              If you didn't change your found set or sort order while the list view was open, then all you need to do is grab the record number into a variable, close the window and go to record number stored in the variable.


              • 4. Re: New Window Issues
                thumper
                   That makes sence, could you please explain how i get the record number into a variable? im only a couple weeks into filemaker, still learning lol. Thanks so much
                • 5. Re: New Window Issues
                  comment_1
                    

                  Roughly:

                   

                  Set Variable [ $n ; Get ( RecordNumber ) ]

                  Close Window

                  Go to Record [ $n ]

                  • 6. Re: New Window Issues
                    thumper
                       WOW, just tried that out and works perfectly! thanks so much for explaining this to me, that will actualy help me out in a bunch of aspects of my database. Thanks again :D
                    • 7. Re: New Window Issues
                      thumper
                        

                      ive come accross a problem and cant figure out a solution.... well i have a layout thats bassically my main animal display layout, but its a listview, and when clicked on a record it opens it up on another window in form mode. the code that was working for me before that i was told to use was:

                       

                      • Set Variable [ $n; Value:Get ( RecordNumber ) ]
                      • Close Window [ Current Window ]
                      • Go to Record/Request/Page [ $n ] [ No dialog ]


                      it was working fine , but i notice now it doesnt, i have added buttons that run scripts to show either only active males or only active females and a button that shows all records in database table.


                      but if i change "RecordNumber" and replace with "RecordID" then it also just shows random records, i say random cause i cant identify the problem/pattern of whats going wrong. there has gotta be a simple solution or alternative way, maybe?


                      here are the button scripts for the males, females and all records im using:

                       

                       

                      Show all active females:

                       

                      • Enter Find Mode [ ]
                      • Set Field [ HP Main::Reptile Sex; "Female" ]
                      • Set Field [ HP Main::Active Inactive; "Active" ]
                      • Perform Find [ ]

                       

                      show all active males:

                       

                      • Enter Find Mode [ ]
                      • Set Field [ HP Main::Reptile Sex; "Male" ]
                      • Set Field [ HP Main::Active Inactive; "Active" ]
                      • Perform Find [ ]



                      show all active animals:

                       

                      • Enter Find Mode [ ]
                      • Set Field [ HP Main::Active Inactive; "Active" ]
                      • Perform Find [ ]

                       

                       

                       

                       

                      Thanks again, 

                       Justin




                      • 8. Re: New Window Issues
                        thumper
                          

                        seems to me its a problem with the foundset, if the found set on the "animal List" window is different than the foundset on the "HP Main" window then it doesnt work, i tested it out by setting both widows to filter the same foundset by running the same "show active males" script on both windows:

                         

                        show all active males:

                         

                        • Enter Find Mode [ ]
                        • Set Field [ HP Main::Reptile Sex; "Male" ]
                        • Set Field [ HP Main::Active Inactive; "Active" ]
                        • Perform Find [ ]

                        it then works perfectly when i click the select button to show the record selected from the list to display in the hp main window, so with problem beeing traced, the solution seems to be that I need to somehow get both window foundsets to be the same as the other, can this be done?

                         


                        • 9. Re: New Window Issues
                          comment_1
                            

                          Perhaps you missed this part in my first reply:

                           

                          "If you didn't change your found set or sort order while the list view was open, then all you need to do is grab the record number ... "

                           

                          If you did, then you need to use another, more complex, method. For example, you could grab the record's serial ID, then perform a find for it in the original window.

                          • 10. Re: New Window Issues
                            thumper
                               I tried grabbing the "HP ID" which is a auto-entered serial number field in my main table that i created, i tried just replacing "Get ( RecordNumber )" with "HP Main::HP ID" but still mixes things up. or do i need to do the "enter find mode, set field, perform find" script step rather then the "set variable, go to variable" script step?
                            • 11. Re: New Window Issues
                              comment_1
                                

                              thumper wrote:
                              do i need to do the "enter find mode, set field, perform find" script step

                              That would be one way, yes. Going to a record by its serial ID (or RecordID) makes no sense - there could be 100 records in the found set, each with a serial ID higher than 100.