1 2 Previous Next 15 Replies Latest reply on Aug 9, 2013 8:09 AM by StewartMcadoo

    Portal layout only displays data irregularly

    StewartMcadoo

      Title

      Portal layout only displays data irregularly

      Post

           I have a layout with a portal containing related data.  The layout is for display only.  Basically there is a top level table with an id and associated data.  Another table contains related with the top level entry with the foreign key the same as the id in the top table.  The subordinate table is built up in a script. The layout shows data from the top level table and the portal containing the rows from the other table just constructed.  Now the problem...For some rows in the top level table I get the display I expect and for other rows in the top with out one or two fields populated in the second table the entire portal is not displayed.  At the end of the script that generates the second table I go to the layout with the portal as the last step expecting to see the second table (and I do for some entries in the top table), but nothing for others.  I've checked the portal setup and the relationships which appear to be correct.  I do populate the FK in the secondary table.  I'm at a loss about this display issue.  What have I missed?  btw, I'm running FM Pro 12 on a win7 machine.

        • 1. Re: Portal layout only displays data irregularly
          philmodjunk

               Is the portal filtered?

               I suggest posting the script that you are using.

               To post a script to the forum:

                 
          1.           You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
          2.      
          3.           You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
          4.      
          5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
          6.      
          7.           If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
          • 2. Re: Portal layout only displays data irregularly
            StewartMcadoo

                 Here is the script.  It gathers some data from a much larger record and writes records to a table, Gayles Report.  It also runs a script to gather payment information for the client in the script run near the front of this script.  It gathers information, if any, from a table generated in the other script and makes more records from information in that table.  If no information in the table from the other script, no additional records are generated and added to the file.  Anyway, if I don't go through the logic to add other records to Gayles Report from the pmt info coming from the script the portal is not displayed in the folder ledger layout.

            • 3. Re: Portal layout only displays data irregularly
              StewartMcadoo

                   oops, can't upload a pdf. let me work on it

              • 4. Re: Portal layout only displays data irregularly
                StewartMcadoo

                     try this:
                     Allow User Abort [ On ]
                     Set Variable [ $$CurrentClientID ; Value:Client DB::ID Number]
                     #Set up a new window for the ledger
                     New Window [ Height: 950; Width: 600; Top: 15; Left: 200;
                     Style: Document ; Close: “Yes”; Minimize: “Yes”; Maximize: “Yes”; Zoom
                     Control Area: “Yes”; Resize: “Yes” ]
                     Set Zoom Level[ 150% ]
                     Show/Hide Toolbars[ Show ]
                     Show/Hide Text Ruler[ Hide ]
                     Freeze Window
                     #Clean out old info from Gayles Report
                     Go to Layout [ “Gayles Report” (Gayles Report)]
                     Delete All Records[ No dialog ]
                     #Go get payment information, make a summary table
                     Perform Script [ “Ins Pmt Summary 1”]
                     // Show Custom Dialog [ Title: "After Ins Pmt Summary execution"; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                     #Go to client sessions table and get all sessions associated with current clieng
                     Go to Layout [ “Client Sessions” (Client Sessions)]
                     Show All Records
                     Enter Find Mode [ Specified Find Requests:
                     Find Records ; Criteria: Client Sessions::Client ID Number : “== $$Client ID” ][ Restore ]
                     Set Error Capture [ On ]
                     Perform Find [ ]
                     Set Error Capture [ Off ]
                     #If there are no session records, there is something wrong, tell the user and exit
                     If [ Get(FoundCount) = 0 ]
                     Show Custom Dialog
                     [ Title: "finding sessions for client"; Message: "records found = " & Get(FoundCount); Default Button:“OK”,Commit: “Yes”; Button 2: “Cancel”,Commit: “No” ]
                     Exit Script [ ]
                     End If
                     #Loop through the client sessions found and move info to rows in Gayles Report
                     Go to Record/Request/Page[ First ]
                     Loop
                     #Get info from session record
                     Set Variable [ $ClientID ; Value:Client Sessions::Client ID Number]
                     Set Variable [ $Date; Value:Client Sessions::Date]
                     Set Variable [ $Ref ; Value:Client Sessions::reference]
                     Set Variable [ $Desc; Value:Client Sessions::Description]
                     Set Variable [ $Chg; Value:Client Sessions::Charge]
                     Set Variable [ $ClientPmt ; Value:Client Sessions::Client Payment]
                     Set Variable [ $Adj; Value:Client Sessions::Adjustment]
                     Set Variable [ $flag; Value:Client Sessions::checkoff]
                     #Make a new record in Gayles Report

                     If [ 0=0 ]

                     Go to Layout [ “Gayles Report” (Gayles Report)]
                     New Record/Request
                     Set Field [ Gayles Report::Client ID ; $ClientID ]
                     Set Field [ Gayles Report::Date ; $Date ]
                     Set Field [ Gayles Report::RefTxt ; $Ref ]
                     Set Field [ Gayles Report::DescTxt ; $Desc ]
                     Set Field [ Gayles Report::Charge ; $Chg ]
                     Set Field [ Gayles Report::ClientPmt ; $ClientPmt ]
                     Set Field [ Gayles Report::flag ; $flag ]
                     Commit Records/Requests[ Skip data entry validation; No dialog]
                     End If
                     Go to Layout [ “Client Sessions” (Client Sessions)]
                     Go to Record/Request/Page[ Next; Exit after last]
                     End Loop
                     #Now use the insurance pmts summary to place a record for each pmt in Gayles Report
                     Go to Layout [ “Ins Co Pmts Summary” (Ins Co Pmts Summary)]
                     Set Error Capture [ On ]
                     Enter Find Mode [ Specified Find Requests:
                     Find Records ; Criteria: Ins Co Pmts Summary::Client ID: “== $$Client ID” ]
                     [ Restore ]
                     Perform Find [ Specified Find Requests:Find Records ; Criteria: Ins Co Pmts Summary::Client ID: “== $ClientID” ]
                     [ Restore ]
                     Set Error Capture [ Off ]
                     If [ Get(FoundCount) ≠ 0 ] -------------------------------If FoundCount equals zero then the layout displayed in the last statement of the script does not    show the portal.  If I go through the following logic to add a few more records I see the portal displayed.
                     #Pmts found, write a record to Gayles Report for each one found
                     Go to Record/Request/Page
                     [ First ]
                     Loop
                     Set Variable [ $ClientID ; Value:Ins Co Pmts Summary::Client ID]
                     Set Variable [ $Date; Value:Ins Co Pmts Summary::Pmt Date]
                     Set Variable [ $Ref ; Value:Ins Co Pmts Summary::Ins Co Name]
                     Set Variable [ $Desc; Value:Ins Co Pmts Summary::Svc Dates]
                     Set Variable [ $AmtPdIns ; Value:Ins Co Pmts Summary::Amt Pd]
                     Set Variable [ $AdjSum; Value:Ins Co Pmts Summary::Adjustment Sum]
                     If [ 0=0 ]
                     Go to Layout [ “Gayles Report” (Gayles Report)]
                     New Record/Request
                     Set Field [ Gayles Report::Client ID ; $ClientID ]
                     Set Field [ Gayles Report::Date ; $Date ]
                     Set Field [ Gayles Report::RefTxt ; $Ref ]
                     Set Field [ Gayles Report::DescTxt ; $Desc ]
                     Set Field [ Gayles Report::AmtPd ; $AmtPdIns ]
                     Set Field [ Gayles Report::Adj ; $AdjSum ]
                     Commit Records/Requests
                     [ Skip data entry validation; No dialog]
                     End If
                     Go to Layout [ “Ins Co Pmts Summary” (Ins Co Pmts Summary)]
                     Go to Layout [ “Ins Co Pmts Summary” (Ins Co Pmts Summary)]
                     Go to Record/Request/Page[ Next; Exit after last]
                     End Loop
                     Else
                     End If
                     #Display the Gayles Report in a portal in the Folder Ledger layout
                     // Go to Layout [ “Gayles Report” (Gayles Report) ]
                     // Sort Records [ Keep records in sorted order; Specified Sort Order: Gayles Report::Date; ascending ]
                     [ Restore; No dialog ]
                     Go to Layout [ “Folder Ledger” (Client DB) ]-----------------The Layout, Folder Ledger, has the portal in it to show data in the table/layout, Gayles Report.  If I stop and display the layout associated with Gayles Report I can see that it is populated or if I look at it after the display it is sitll populated but the data is not shown on the portal.  I'm only talking about 6 or so records and the portal is configured to 20+ lines.  It does not have a filter configured and I do not wish to edit rows in the portal.  This is only for display and output.

                • 5. Re: Portal layout only displays data irregularly
                  philmodjunk

                       I took the liberty of pretty printing your script to better track the function of the IF and loop blocks....

                       There appears to be a variable naming discrepancy shown in red. The global variable, $$Client ID is never assigned a value. A different global variable,, $$CurrentClientID is assigned a value but is then never used in your script. Since both are global variables, other scripts could, conceivably modify the values in either variable or could refer to them, but I have no way of knowing if this is the case or not.

                       Script steps with strikethrough formatting are steps that you can delete from this script and the script will still function the same as it does now.

                       Question 1: Is the portal based on this relationship?

                       Client DB::ID Number = Gales Report::Client ID Number

                       Question 2: what does the script "Ins Pmt Summary 1" do?

                       Allow User Abort [ On ]
                       Set Variable [ $$CurrentClientID ; Value:Client DB::ID Number]
                       #Set up a new window for the ledger
                       New Window [ Height: 950; Width: 600; Top: 15; Left: 200;
                       Style: Document ; Close: “Yes”; Minimize: “Yes”; Maximize: “Yes”; Zoom
                       Control Area: “Yes”; Resize: “Yes” ]
                       Set Zoom Level[ 150% ]
                       Show/Hide Toolbars[ Show ]
                       Show/Hide Text Ruler[ Hide ]
                       Freeze Window
                       #Clean out old info from Gayles Report
                       Go to Layout [ “Gayles Report” (Gayles Report)]
                       Delete All Records[ No dialog ]
                       #Go get payment information, make a summary table
                       Perform Script [ “Ins Pmt Summary 1”]
                       // Show Custom Dialog [ Title: "After Ins Pmt Summary execution"; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                       #Go to client sessions table and get all sessions associated with current clieng
                       Go to Layout [ “Client Sessions” (Client Sessions)]
                  Show All Records
                       Enter Find Mode [ Specified Find Requests:
                       Find Records ; Criteria: Client Sessions::Client ID Number : “== $$Client ID” ][ Restore ]
                       Set Error Capture [ On ]
                       Perform Find [ ]
                       Set Error Capture [ Off ]
                       #If there are no session records, there is something wrong, tell the user and exit
                           If [ Get(FoundCount) = 0 ]
                               Show Custom Dialog
                               [ Title: "finding sessions for client"; Message: "records found = " & Get(FoundCount); Default Button:“OK”,Commit: “Yes”; Button 2: “Cancel”,Commit: “No” ]
                               Exit Script [ ]
                           End If
                           #Loop through the client sessions found and move info to rows in Gayles Report
                               Go to Record/Request/Page[ First ]
                               Loop
                                   #Get info from session record
                                   Set Variable [ $ClientID ; Value:Client Sessions::Client ID Number]
                                   Set Variable [ $Date; Value:Client Sessions::Date]
                                   Set Variable [ $Ref ; Value:Client Sessions::reference]
                                   Set Variable [ $Desc; Value:Client Sessions::Description]
                                   Set Variable [ $Chg; Value:Client Sessions::Charge]
                                   Set Variable [ $ClientPmt ; Value:Client Sessions::Client Payment]
                                   Set Variable [ $Adj; Value:Client Sessions::Adjustment]
                                   Set Variable [ $flag; Value:Client Sessions::checkoff]
                                   #Make a new record in Gayles Report
                                   If [ 0=0 ]
                                       Go to Layout [ “Gayles Report” (Gayles Report)]
                                       New Record/Request
                                       Set Field [ Gayles Report::Client ID ; $ClientID ]
                                       Set Field [ Gayles Report::Date ; $Date ]
                                       Set Field [ Gayles Report::RefTxt ; $Ref ]
                                       Set Field [ Gayles Report::DescTxt ; $Desc ]
                                       Set Field [ Gayles Report::Charge ; $Chg ]
                                       Set Field [ Gayles Report::ClientPmt ; $ClientPmt ]
                                       Set Field [ Gayles Report::flag ; $flag ]
                                       Commit Records/Requests[ Skip data entry validation; No dialog]
                                   End If
                                   Go to Layout [ “Client Sessions” (Client Sessions)]
                                   Go to Record/Request/Page[ Next; Exit after last]
                               End Loop
                               #Now use the insurance pmts summary to place a record for each pmt in Gayles Report
                               Go to Layout [ “Ins Co Pmts Summary” (Ins Co Pmts Summary)]
                               Set Error Capture [ On ]
                               Enter Find Mode [ Specified Find Requests:
                               Find Records ; Criteria: Ins Co Pmts Summary::Client ID: “== $$Client ID” ]
                               [ Restore ]

                               Perform Find [ Specified Find Requests:Find Records ; Criteria: Ins Co Pmts Summary::Client ID: “== $ClientID” ]
                               [ Restore ]
                               Set Error Capture [ Off ]
                               If [ Get(FoundCount) ≠ 0 ] -------------------------------If FoundCount equals zero then the layout displayed in the last statement of the script does not    show the portal.  If I go through the following logic to add a few more records I see the portal displayed.
                                   #Pmts found, write a record to Gayles Report for each one found
                                   Go to Record/Request/Page [ First ]
                                   Loop
                                       Set Variable [ $ClientID ; Value:Ins Co Pmts Summary::Client ID]
                                       Set Variable [ $Date; Value:Ins Co Pmts Summary::Pmt Date]
                                       Set Variable [ $Ref ; Value:Ins Co Pmts Summary::Ins Co Name]
                                       Set Variable [ $Desc; Value:Ins Co Pmts Summary::Svc Dates]
                                       Set Variable [ $AmtPdIns ; Value:Ins Co Pmts Summary::Amt Pd]
                                       Set Variable [ $AdjSum; Value:Ins Co Pmts Summary::Adjustment Sum]
                                       If [ 0=0 ]
                                           Go to Layout [ “Gayles Report” (Gayles Report)]
                                           New Record/Request
                                           Set Field [ Gayles Report::Client ID ; $ClientID ]
                                           Set Field [ Gayles Report::Date ; $Date ]
                                           Set Field [ Gayles Report::RefTxt ; $Ref ]
                                           Set Field [ Gayles Report::DescTxt ; $Desc ]
                                           Set Field [ Gayles Report::AmtPd ; $AmtPdIns ]
                                           Set Field [ Gayles Report::Adj ; $AdjSum ]
                                           Commit Records/Requests
                                           [ Skip data entry validation; No dialog]
                                       End If
                                       Go to Layout [ “Ins Co Pmts Summary” (Ins Co Pmts Summary)]
                                       Go to Layout [ “Ins Co Pmts Summary” (Ins Co Pmts Summary)]
                                       Go to Record/Request/Page[ Next; Exit after last]
                                   End Loop
                               Else
                               End If
                               #Display the Gayles Report in a portal in the Folder Ledger layout
                               // Go to Layout [ “Gayles Report” (Gayles Report) ]
                               // Sort Records [ Keep records in sorted order; Specified Sort Order: Gayles Report::Date; ascending ]
                               [ Restore; No dialog ]
                               Go to Layout [ “Folder Ledger” (Client DB) ]
                        

                       Any time that you have large, complex scripts like this, FileMaker Advanced's Script Debugger and Data Viewer tools become invaluable in being able to watch the script execute step by step. That is also a way to see if any script triggers are being tripped by the layout or record changes--which could also affect the results produced by this script.

                  • 6. Re: Portal layout only displays data irregularly
                    StewartMcadoo

                                        I took the liberty of pretty printing your script to better track the function of the IF and loop blocks....  Definitely

                                        There appears to be a variable naming discrepancy shown in red. The global variable, $$Client ID is never assigned a value. A different global variable,, $$CurrentClientID is assigned a value but is then never used in your script. Since both are global variables, other scripts could, conceivably modify the values in either variable or could refer to them, but I have no way of knowing if this is the case or not.

                    $$ClientID is set in another script triggered by display of a record of the layout that has the button it that initiates this script.  Tells this script the client on which to make the display.  Using the debugger I note at the start of this script $$ClientID has the appropriate value. The variable $$CurrentClientID is used as communication of the variable to which it is set into the script, Ins Pmt Summary 1.

                                        Script steps with strikethrough formatting are steps that you can delete from this script and the script will still function the same as it does now.

                    Yep.  Some are scar tissue from debug attempts the if [0=0] construct is to force indenting.

                                        Question 1: Is the portal based on this relationship?

                                        Client DB::ID Number = Gales Report::Client ID Number

                    Yes  The main layout on which the user (me) works displays information about a client from a table containing the clients and metadata about them.  Gayles Report uses Client ID as a foriegn key back to the main table.  The layout, Folder Ledger, also displays info from the main table of clients and then has the portal to show the specific session and payment info. So the layout Folder Ledger displays data from a record in Client DB which uses ClientID as its primary key.  I put the same value into records in Gayles Report as the foreign key.  I have looked at Gayles Reprot after Folder Ledger is displayed without the portal info and the table Gayles Report has the appropriate records that should be displayed and the forein key, ClientID is populated appropriately.

                                        Question 2: what does the script "Ins Pmt Summary 1" do?

                    It produces a table of insurance payments, layout "Ins Co Pmts Summary" that is used toward the end of this script to add payment rows to Gayles Report.  In the case with which I am having a problem, it produces an empty table. This results in the test, If [ Get(FoundCount) ≠ 0 ], to fail and the empty table is never used in the case that fails to display the portal. observed by stepping through the script using the debugger.

                                        Allow User Abort [ On ]
                                        Set Variable [ $$CurrentClientID ; Value:Client DB::ID Number]
                                        #Set up a new window for the ledger
                                        New Window [ Height: 950; Width: 600; Top: 15; Left: 200;
                                        Style: Document ; Close: “Yes”; Minimize: “Yes”; Maximize: “Yes”; Zoom
                                        Control Area: “Yes”; Resize: “Yes” ]
                                        Set Zoom Level[ 150% ]
                                        Show/Hide Toolbars[ Show ]
                                        Show/Hide Text Ruler[ Hide ]
                                        Freeze Window
                                        #Clean out old info from Gayles Report
                                        Go to Layout [ “Gayles Report” (Gayles Report)]
                                        Delete All Records[ No dialog ]
                                        #Go get payment information, make a summary table
                                        Perform Script [ “Ins Pmt Summary 1”]
                                        // Show Custom Dialog [ Title: "After Ins Pmt Summary execution"; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                        #Go to client sessions table and get all sessions associated with current clieng
                                        Go to Layout [ “Client Sessions” (Client Sessions)]
                    Show All Records
                                        Enter Find Mode [ Specified Find Requests:
                                        Find Records ; Criteria: Client Sessions::Client ID Number : “== $$Client ID” ][ Restore ]
                                        Set Error Capture [ On ]
                                        Perform Find [ ]
                                        Set Error Capture [ Off ]
                                        #If there are no session records, there is something wrong, tell the user and exit
                                            If [ Get(FoundCount) = 0 ]
                                                Show Custom Dialog
                                                [ Title: "finding sessions for client"; Message: "records found = " & Get(FoundCount); Default Button:“OK”,Commit: “Yes”; Button 2: “Cancel”,Commit: “No” ]
                                                Exit Script [ ]
                                            End If
                                            #Loop through the client sessions found and move info to rows in Gayles Report
                                                Go to Record/Request/Page[ First ]
                                                Loop
                                                    #Get info from session record
                                                    Set Variable [ $ClientID ; Value:Client Sessions::Client ID Number]
                                                    Set Variable [ $Date; Value:Client Sessions::Date]
                                                    Set Variable [ $Ref ; Value:Client Sessions::reference]
                                                    Set Variable [ $Desc; Value:Client Sessions::Description]
                                                    Set Variable [ $Chg; Value:Client Sessions::Charge]
                                                    Set Variable [ $ClientPmt ; Value:Client Sessions::Client Payment]
                                                    Set Variable [ $Adj; Value:Client Sessions::Adjustment]
                                                    Set Variable [ $flag; Value:Client Sessions::checkoff]
                                                    #Make a new record in Gayles Report
                                                    If [ 0=0 ]
                                                        Go to Layout [ “Gayles Report” (Gayles Report)]
                                                        New Record/Request
                                                        Set Field [ Gayles Report::Client ID ; $ClientID ]
                                                        Set Field [ Gayles Report::Date ; $Date ]
                                                        Set Field [ Gayles Report::RefTxt ; $Ref ]
                                                        Set Field [ Gayles Report::DescTxt ; $Desc ]
                                                        Set Field [ Gayles Report::Charge ; $Chg ]
                                                        Set Field [ Gayles Report::ClientPmt ; $ClientPmt ]
                                                        Set Field [ Gayles Report::flag ; $flag ]
                                                        Commit Records/Requests[ Skip data entry validation; No dialog]
                                                    End If
                                                    Go to Layout [ “Client Sessions” (Client Sessions)]
                                                    Go to Record/Request/Page[ Next; Exit after last]
                                                End Loop
                                                #Now use the insurance pmts summary to place a record for each pmt in Gayles Report
                                                Go to Layout [ “Ins Co Pmts Summary” (Ins Co Pmts Summary)]
                                                Set Error Capture [ On ]
                                                Enter Find Mode [ Specified Find Requests:
                                                Find Records ; Criteria: Ins Co Pmts Summary::Client ID: “== $$Client ID” ]
                                                [ Restore ]

                                                Perform Find [ Specified Find Requests:Find Records ; Criteria: Ins Co Pmts Summary::Client ID: “== $ClientID” ]
                                                [ Restore ]
                                                Set Error Capture [ Off ]
                                                If [ Get(FoundCount) ≠ 0 ] -------------------------------If FoundCount equals zero then the layout displayed in the last statement of the script does not    show the portal.  If I go through the following logic to add a few more records I see the portal displayed.
                                                    #Pmts found, write a record to Gayles Report for each one found
                                                    Go to Record/Request/Page [ First ]
                                                    Loop
                                                        Set Variable [ $ClientID ; Value:Ins Co Pmts Summary::Client ID]
                                                        Set Variable [ $Date; Value:Ins Co Pmts Summary::Pmt Date]
                                                        Set Variable [ $Ref ; Value:Ins Co Pmts Summary::Ins Co Name]
                                                        Set Variable [ $Desc; Value:Ins Co Pmts Summary::Svc Dates]
                                                        Set Variable [ $AmtPdIns ; Value:Ins Co Pmts Summary::Amt Pd]
                                                        Set Variable [ $AdjSum; Value:Ins Co Pmts Summary::Adjustment Sum]
                                                        If [ 0=0 ]
                                                            Go to Layout [ “Gayles Report” (Gayles Report)]
                                                            New Record/Request
                                                            Set Field [ Gayles Report::Client ID ; $ClientID ]
                                                            Set Field [ Gayles Report::Date ; $Date ]
                                                            Set Field [ Gayles Report::RefTxt ; $Ref ]
                                                            Set Field [ Gayles Report::DescTxt ; $Desc ]
                                                            Set Field [ Gayles Report::AmtPd ; $AmtPdIns ]
                                                            Set Field [ Gayles Report::Adj ; $AdjSum ]
                                                            Commit Records/Requests
                                                            [ Skip data entry validation; No dialog]
                                                        End If
                                                        Go to Layout [ “Ins Co Pmts Summary” (Ins Co Pmts Summary)]
                                                        Go to Layout [ “Ins Co Pmts Summary” (Ins Co Pmts Summary)]
                                                        Go to Record/Request/Page[ Next; Exit after last]
                                                    End Loop
                                                Else
                                                End If
                                                #Display the Gayles Report in a portal in the Folder Ledger layout
                                                // Go to Layout [ “Gayles Report” (Gayles Report) ]
                                                // Sort Records [ Keep records in sorted order; Specified Sort Order: Gayles Report::Date; ascending ]
                                                [ Restore; No dialog ]
                                                Go to Layout [ “Folder Ledger” (Client DB) ]
                                         

                                        Any time that you have large, complex scripts like this, FileMaker Advanced's Script Debugger and Data Viewer tools become invaluable in being able to watch the script execute step by step. That is also a way to see if any script triggers are being tripped by the layout or record changes--which could also affect the results produced by this script. 

                    I do have Advanced although this is my first foray into the Script Debugger.  I'm still trying to get used to it although I'm a little familiar with code debuggers from a past life.  This script is only invoked by a button on the main menu as I noted above.

                          

                    • 7. Re: Portal layout only displays data irregularly
                      StewartMcadoo

                           btw,  Not sure I mentioned it but I run the script with a different client such that the script, Ins Pmt Summary 1, does produce a non-empty table, Ins Co Pmts Summary, and lines are added to the table, Gayles Report, based on it,  then the portal is correctly displayed.

                      • 8. Re: Portal layout only displays data irregularly
                        philmodjunk

                             It sounds like the script you posted is doing exactly what it is designed to do. If the script Ins Pmt Summary 1 does not create any records, then there are no records that you can loop through in the bottom loop in your script. Only any records created in the first loop could possibly appear in your portal to Gayles Report.

                             So if there is an issue, it would appear that the script not yet shown here, Ins Pmt Summary 1, would be the culprit in that it is failing to create the expected records in the Ins Co Pmts Summary table.

                        This script is only invoked by a button on the main menu as I noted above.

                             Yes, but any script that changes layouts can trip any of the following script triggers: OnLayoutExit, OnLayoutEnter, OnObjectExit, OnObjectEnter and many more besides if you have set them up on either the layout being exited or the new layout being entered. By stepping through the script in the debugger, you will see the current script be interrupted by a trigger controlled script should a step in the first script trip such a script trigger.

                        • 9. Re: Portal layout only displays data irregularly
                          StewartMcadoo

                                              It sounds like the script you posted is doing exactly what it is designed to do. If the script Ins Pmt Summary 1 does not create any records, then there are no records that you can loop through in the bottom loop in your script. Only any records created in the first loop could possibly appear in your portal to Gayles Report.

                          Yes the first loop does create records and puts them into the Gayles Report table and they are not being shown although they are in the table, Gayles Report.

                                              So if there is an issue, it would appear that the script not yet shown here, Ins Pmt Summary 1, would be the culprit in that it is failing to create the expected records in the Ins Co Pmts Summary table.

                          No, it's also doing what is expected.  In the case that presents the issue, there are no payment entries to be found so it reports back an empty table.  I check how may records are in the table and if there are none then I don't do the loop to create records from it.

                          This script is only invoked by a button on the main menu as I noted above.

                                              Yes, but any script that changes layouts can trip any of the following script triggers: OnLayoutExit, OnLayoutEnter, OnObjectExit, OnObjectEnter and many more besides if you have set them up on either the layout being exited or the new layout being entered. By stepping through the script in the debugger, you will see the current script be interrupted by a trigger controlled script should a step in the first script trip such a script trigger.

                          "changes layouts"?? I don't change layouts, rather the contents of one.  I basically don't have a problem with the behavior of either script until the last statement of  where if there are insurance payments the go to layout works and displays the portal contents just generated whereas if there are no insurance payment the go to layout shows the layout with the portal empty even though just before and just after the go to display the table on which the portal is based is correctly populated. The layout is displayed with the information, including the correct client data above the portal  but no related portal information,

                          That being said, how do I use the debugger to detect trigger actions while executing the scripts?

                                               

                                

                          • 10. Re: Portal layout only displays data irregularly
                            philmodjunk

                                 steps like: Go to Layout [ “Ins Co Pmts Summary” (Ins Co Pmts Summary)]

                                 Change layouts. They change your focus from one layout to another. When you click the buttons to advance through the script one step at a time, if a go to layout or other script step trips a script trigger and thus performs a script, that script automatically pops up in the debugger. You then step through that script until it completes, at which point control reverts to the original script and execution proceeds to the next script step, but that intervening script could have made any number of changes to what layout and layout obaject has the focus, what record is current, etc. and that could alter the results produced by your script. I'm not saying that this is what is happening here, only noting that it's easy to see such things happen when you step through a script in the script debugger.

                                 Back to the issue at hand. Is this what you are describing?

                                 You run the script from the "folder ledger" layout.

                                 The Ins Pmt Summary 1 script does not create any records in the Ins Co Pmts Summary table.

                                 The upper loop cycles through records in the client sessions table and creates new records in the Gayles Report table.

                                 The lower loop exits without creating any records because the above named script did not create any to loop through.

                                 The script returns you to "folder ledger" and you see a portal to Gayles Report that is empty, but if you switch over to the Gayles Report layout, you see the records created by the upper loop in this script.

                                 And this portal to Gayles Report is not a filtered portal.

                                 If that is not correct, please let me know.

                                 One possibility comes to mind. Please post a screen shot of Mange | Database | RElationships. Zoom and crop to just show Client DB, Gayles Report and Ins Co Pmts Summary and the relationship lines that connect them.

                            • 11. Re: Portal layout only displays data irregularly
                              StewartMcadoo

                                   The Portal to Gayles Report in the Folder Ledger is not filtered.  By that I assume you mean if I go to layout for Folder Ledger and look at Portal Setup I would see the Filter Portal Records  box checked and something in the sub window when I click Specify.  There is nothing in Specify and the Filter Portal Records box is not checked in the Portal Setup box.  I do sort Portal Records on Date and I have checked Allow Deletion (although I don't want to, I just tried it to see if it had any affect...it didn't) and Show vertical scroll bar is checked.  I show a request for up to 60 rows.

                                   The other side of the test is if Print Summary 1 does put records into Co Pmts Summary and the lower loop does execute and does put records into Gayles Record in another case, I do see the portal displayed in Folder Ledger.

                                   Yes, your summary of what I observe is correct.  I'm curous what your other possiblity might be.

                                    

                                    

                                    

                                    

                              • 12. Re: Portal layout only displays data irregularly
                                philmodjunk

                                     to Repeat:

                                     One possibility comes to mind. Please post a screen shot of Mange | Database | RElationships. Zoom and crop to just show Client DB, Gayles Report and Ins Co Pmts Summary and the relationship lines that connect them.

                                • 13. Re: Portal layout only displays data irregularly
                                  StewartMcadoo

                                       Here it is, I hope.

                                  • 14. Re: Portal layout only displays data irregularly
                                    philmodjunk

                                         This confirms my suspiscion.

                                         If there are no records created in the second loop, there is no connection possible between Client DB as at least one table between Client Db and Gayles Report will be empty and thus the portal is empty.

                                         You need to link an occurrence of Gayles Report directly to the Client DB occurrence on which you base your layout. Either add a new occurrence of Gayles Report for that, or change over your layout to be based on Client DB 3. If you use Layout Setup to specify Client DB 3, you'll need to double click each field from Client DB while in layout mode to reselect them as fields from Client DB 3.

                                    1 2 Previous Next