11 Replies Latest reply on Jun 24, 2010 4:18 PM by nolak37

    Set Window Title

    nolak37

      Title

      Set Window Title

      Post

      Hello,

      I have a script that opens a new window and goes to one of 2 layouts depending if gender is set to male or female, this is determined by an if statement.

       

      After both if statements I have show/hide status area Lock;Hide, Allow Toolbars OFF, and Set window title [Current window; Pts::LName & " " Pts::FName & " " Pts::DOB]

       

      Problem here is that when I press the button to run th script the title comes out blank. As an experiment I set ( <<Pts::LName>> ) at top of page and this works perfectly. Also I noticed that if i return to the same record 2-3 min later and run the script it does set the title.

       

      Has anyone experienced something like this, am I doing something wrong?

        • 1. Re: Set Window Title
          philmodjunk

          You'll need to check to see what layout and record is current at the time this step executes. If you are on the wrong layout or there is no record in the found set, then you'd get a blank window title.

           

          If examining your script doesn't show any obvious errors, you might want to either use the script debugger (if you have filemaker advanced ) to step through your script or you can temporarily add a pause/resume script step just before the Set window title step to see where you are and what state the database is in at the moment this the window title is set.

          • 2. Re: Set Window Title
            nolak37

            Hey Phil,

             

            I tried the script debugger and everything seems correct. All the steps are followed in order that they need to be and the window title is set, the problem is the window title should display something like "Doe John is a 22 year old male" gathering the data from a related field and what actually displays is "is a  old".

             

            If I try the script again a few minutes later then all the info comes out correctly.

             

            It appears that its taking a while to find the information from the related field.

             

            Any ideas?

             

            • 3. Re: Set Window Title
              philmodjunk

              Did you use the data viewer to check the value of each field at the point where the window title is set?

               

              If you are  setting a value in a field so that matching data in a related table can be accessed, you may need a commit record step before you set the window title.

              • 4. Re: Set Window Title
                nolak37

                ok so after reviewing the table and script, I have concluded the problem lies in the way the relationship is set up. The Name is not appearing until around 2 minutes later in the field or as the title.

                 

                The ralation is as follows:

                3 tables

                 

                Pts, Visits, Billing

                 

                Pts::Pt_ID----------------------Visits::Pt_ID

                Visit::MV_ID--------------------Billing:MV_ID

                 

                In the "Visit List" Layout I select the Visit ID number and this opens a new window set up as Billing Layout but including fields of Visit table for reference. I need the title to be the Pts name and age but in order to get the information Filemaker has to go to the related Visit and find the related Pts record. this is aparently taking somewhere arround 1-2 min. and ten the title is set as I needed. Is there a way to remedy this.

                • 5. Re: Set Window Title
                  philmodjunk

                  This should not take anything close to 1 minute, let alone 2. Such a link should be nearly instantaneous.

                  • 6. Re: Set Window Title
                    nolak37

                    Well thats what I initially thought however I havent found any other reason to why this is happening, as mentioned earlier the script seems fine I checked it with script debugger, and eventually the name does pop up it just takes that long to do so.

                    • 7. Re: Set Window Title
                      philmodjunk

                      Please post your script so I can see it. You can make a database design report and copy the script from it in order to paste it here.

                      • 8. Re: Set Window Title
                        nolak37

                        Sure, Its long but here it is

                         

                        • Set Variable [ $MV_ID; Value:MV::MV_ ID ]
                        • If [ MV::Chief Comp = "Child Physical" ]
                        • New Window [ Top: 50; Left: 100 ]
                        • Show Custom Dialog [ Title: "Billing Type"; Message: "What type of bill is this"; Buttons: “PM160”, “HCFA 1500” ]
                        • If [ Get ( LastMessageChoice ) = 1 ]
                        • Go to Layout [ “Child Development (Billing) CHDP” (CHDP Billing) ]
                        • Set Error Capture [ On ]
                        • Enter Find Mode [ ]
                        • Set Field [ CHDP Billing::MV_ID; $MV_ID ]
                        • Perform Find [ ]
                        • If [ Get ( FoundCount ) = 0 ]
                        • New Record/Request
                        • Set Field [ CHDP Billing::MV_ID; $MV_ID ]
                        • End If
                        • Else
                        • Go to Layout [ “Child Well Development (Billing)” (Billing) ]
                        • Set Error Capture [ On ]
                        • Enter Find Mode [ ]
                        • Set Field [ Billing::Medical Visit ID; $MV_ID ]
                        • Perform Find [ ]
                        • If [ Get ( FoundCount ) = 0 ]
                        • New Record/Request
                        • Set Field [ Billing::Medical Visit ID; $MV_ID ]
                        • Set Field [ Billing::Printed; "no" ]
                        • End If
                        • End If
                        • Else If [ Pts::Gen = "male" ]
                        • New Window [ Top: 50; Left: 100 ]
                        • Go to Layout [ “Male Visit (Billing)” (Billing) ]
                        • Set Error Capture [ On ]
                        • Enter Find Mode [ ]
                        • Set Field [ Billing::Medical Visit ID; $MV_ID ]
                        • Perform Find [ ]
                        • If [ Get ( FoundCount ) = 0 ]
                        • New Record/Request
                        • Set Field [ Billing::Medical Visit ID; $MV_ID ]
                        • Set Field [ Billing::Printed; "no" ]
                        • End If
                        • Else If [ Pts::Gen = "female" ]
                        • New Window [ Top: 50; Left: 100 ]
                        • Go to Layout [ “Female Visit (Billing)” (Billing) ]
                        • Set Error Capture [ On ]
                        • Enter Find Mode [ ]
                        • Set Field [ Billing::Medical Visit ID; $MV_ID ]
                        • Perform Find [ ]
                        • If [ Get ( FoundCount ) = 0 ]
                        • New Record/Request
                        • Set Field [ Billing::Medical Visit ID; $MV_ID ]
                        • Set Field [ Billing::Printed; "no" ]
                        • End If
                        • End If
                        • Set Window Title [ Current Window; New Title: Pts::LName & " " & Pts::FName & " is a " & Pts::Age & " old " & Pts::Gen ]
                        • Allow Toolbars [ Off ]
                        • Show/Hide Status Area [ Lock; Hide ]
                        • 9. Re: Set Window Title
                          philmodjunk

                          See what happens if you insert Commit Record just before the set window title step.

                           

                          Also, you have one branch of your code, when the user clicks "PM160" in the custom dialog that switches to a layout with a different table occurrence ( CHDP Billing ) than the other three branches: (They switch switch to layouts based on "billing"). Since different table occurrences are typically used to define different relationships, you should confirm that this table occurrence also links to the Pt table occurrence in your relationship graph to make sure that the fields referenced in the set window title step are accessible and that the correct pt record is being referenced.

                          • 10. Re: Set Window Title
                            nolak37

                            You entioned adding the Commit record before and I tried it then but that changed nothing. I also tried adding a pause script for 2 seconds after commit record to give it time in case it was needed and still nothing. I also checked and both table occurances are related in the same fashion, through MV_ID and the MV is related to the Patients file through PT_ID on both MV and Pts Table.

                             

                            I tried correcting the problem on my own for 2 days before coming for help and im afraid im running out of hair to pull. LOL

                            • 11. Re: Set Window Title
                              nolak37

                              While im still  not sure what the problem is I did notice that interacting with some of these fields speeds up the process of linking the bill with the Patient.

                               

                              This is not by any means the solution I wanted but it takes care of things.

                              first I added Set Variable and selected chief complaint then set field chief complaint with that variable, this just replaces what was in the field for itself. Then close current window and  perform script, then selected a copy I made of the same script without the close window and perform script part.

                               

                              So this opens the window creates a bill if there isnt one already created and closes the window only to reopen it. the second time the window opens the name is set on the title bar as I wanted.

                               

                              Strange way to go about doing it but untill I can find another solution this will do the trick.