4 Replies Latest reply on Jun 20, 2014 8:50 PM by rmittelman

    Properly Navigate to Child Record

    rmittelman

      I have a database for billing time on contract. Like a timesheet entry program. This is based on the Time Billing starter solution.

       

      First table is called Agencies:

      Agency ID (incrementing)

      Name

      Address

      etc.

       

      Next table is Clients:

      Client ID (incrementing)

      Agency ID

      Name

      etc.

       

      Next table is Timesheets:

      Client ID

      Timesheet ID (incrementing)

      Date

      Status ("Billed" or "Unbilled")

      etc.

       

      They have relationships as expected:

      Agencies --> Clients

      Clients --> Timesheets

       

      There are 2 TO's, Billed Timesheets and Unbilled Timesheets, with filtering on Client ID and Status

       

      Main form is based on Agencies, with a portal to Clients table.

      There are also portals to Billed Timesheets and Unbilled Timesheets TO's based on above relationships.

       

      When I bring up an Agency record, the Clients portal properly refreshes and shows me the related clients.

      When I click on a Client in that portal, what I want to happen is the Billed and Unbilled timesheets portals refresh properly and show those timesheets. This is not happening.

       

      So I put a trigger in the Clients portal for "on object enter" which is supposed to trigger whenever a new portal row is clicked. This runs a script to refresh the 2 portals to the Timesheets TO's, but it doesn't actually help.

       

      I *think* this isn't working because the proper Clients record isn't becoming the active record in Clients, and therefore the relationships to the Timesheet tables is not properly updating.

      Is there any idea from this description why the lower-level Timesheets portals are not updating when I click on a portal row in the Clients portal?
      Thanks in advance...
        • 1. Re: Properly Navigate to Child Record
          BruceRobertson

          "This runs a script to refresh the 2 portals to the Timesheets TO's, but it doesn't actually help."

           

          It would probably help to know what that script actually does.

          • 2. Re: Properly Navigate to Child Record
            rmittelman

            Presently all the script does is call Refresh Object twice, each one with the name of the appropriate portal. I put this script in in lieu of Refresh Window, as something may be needed to refresh the cached data in the portals.

            • 3. Re: Properly Navigate to Child Record
              Mike_Mitchell

              I *think* this isn't working because the proper Clients record isn't becoming the active record in Clients, and therefore the relationships to the Timesheet tables is not properly updating.

               

              Very likely. If you have multiple clients per agency, then all timesheets for all clients associated with that agency will be shown in the portal, no matter how many refreshes you execute. This is because of the way the relationships work; if you follow your Relationships Graph, there's an implied found set or filtering that goes on from Agencies -> Clients -> Timesheets. Just clicking a row in a portal does nothing to change that. What you're going to need to do is filter the portals based on just the client you want to see.

               

              One way to do this is to create a global Client ID field and point that to a new set of TOs for billed and unbilled timesheets (using constants in the Agencies table to make up the filtering criteria). Another way would be a set of filtered portals that uses the filters to display just the billed / unbilled records, as needed. The key is, you have to grab the desired Client ID, stick it into the global field, and then refresh the window to make this work.

               

              Bruce may have a slicker method.

               

              HTH

               

              Mike

              • 4. Re: Properly Navigate to Child Record
                rmittelman

                Hey Mike.

                 

                That was indeed the issue. I didn't realize that the relationship basically carried with it an implied found set of all agencies. I modified the client ID field in the AGENCY table to be global, then modified the filter for both portals to add a match to the global field in the agency table. In the script that fires when I click on the clients portal, I put a step that sets the client ID field in the AGENCY table to the value of the client ID from the CLIENT table. Now all works properly. I didn't need to create new portals after all. I did need to add a refresh window script step with flush cached join results to force the portals to refresh.

                 

                Thanks...