1 2 Previous Next 16 Replies Latest reply on Dec 14, 2009 5:56 PM by HugoLidia

    Only some of portal record fields showing.

    HugoLidia

      Title

      Only some of portal record fields showing.

      Post

      Using Windows XP SP3 & Filemaker Pro 10

       

      I have a client view, with a  portal to their policies which all display correctly and we can input new clients and then new policies for each.

       

      The problem is, depending on the policy type, we need to input different data so I have a tabbed control on the same page that should enable the user to input the extra field values, but the fileds in the tabbed control do not change/are not sync'd to the same policy record?  e.g. if it is a car policy after the USers enters CAR as the type in the portal summary and then tab to exit this field the tab control page shopuld change to CARS and display fields like make, model, reg etc.  If the client has more than one car policy, this should not be a problem, but the fileds in the tab control are not changing.

       

      Hope I have explained this clearly.  Am sure there is something simple I have missed.  Will be grateful for somebody putting me straight.

        • 1. Re: Only some of portal record fields showing.
          philmodjunk
            

          Please describe how you've currently set up your tab control.

           

          Do you have a different tab for each type of policy and want a different tab to become visible after the user has selected a policy type or do you want the fields/labels inside the tab to change based on the type selected?

          • 2. Re: Only some of portal record fields showing.
            HugoLidia
               I have a different tab for each policy type - is easier for User to envisage and use.
            • 3. Re: Only some of portal record fields showing.
              philmodjunk
                

              You would have to write a script for this after first naming each of your tab control's tabs.

               

              In Layout mode, bring up the Object Info Palette.

              Select each  tab in turn and enter a unqiue name in Object Info's Object Name box. I'd name each tab by it's policy type so that the name matches your types entered in the portal.

               

              You can then write a script:

               

              Go To Object [PortalTable:: PolicyTypeField]

               

              If you use a script trigger to perform this script when the user exits the policy type field, you should see the matching tab become visible.

              • 4. Re: Only some of portal record fields showing.
                HugoLidia
                   That neatly moves the User to the correct tab, but the fields are not in sync with the record being entered.  The field shown does not change.
                • 5. Re: Only some of portal record fields showing.
                  philmodjunk
                    

                  Nor would it. You need to set up an additional relationship that your same script trigger updates. The title of this thread bothers me a bit because, as far as I can tell, the fields that aren't updating aren't inside a portal, they're inside a tab control that you want to show data from the same record as that shown in the currently selected/active row in your portal. Is this correct?

                   

                  You appear to have the following relationship between your Clients and Policies tables:

                   

                  Clients::ClientID = Policies::ClientID

                   

                  That makes your Portal work, but you potentially have many related Policy records for a given Client record. In order for you to reference data in a user selected Policy record for the current client, you'll need to do some more design work here.

                   

                  Open Manage | Database | Fields

                  If you don't already have one, add a serial ID field to the Policies table, PolicyID.

                  Add a global number field, gPolicyID to the Clients table. (Make the field global in Field Options | Storage.)

                  Click the Relationships tab

                  Click the Policies Table Occurrence (the box with this name).

                  CLick the button with two plus signs in the lower left corner.

                  This makes a new Table Occurrence Box that also displays data from Policies.

                  Name this new TO, SelectedPolicy.

                  Connect this new TO to Clients by dragging from Clients::gPolicyID to Policies:: PolicyID

                  Click OK to leave Manage | Database

                  Enter Layout mode, Double click each field in your tabs that comes from Policy and select them from SelectedPolicy instead of Policies.

                   

                  In your triggered script, add the following steps:

                   

                  Set Field [Clients::gPolicyID; Policies:: PolicyID]

                  Commit Record

                   

                   

                   

                   

                  • 6. Re: Only some of portal record fields showing.
                    HugoLidia
                      

                    Appreciate your help on this PhilModJunk.

                    Just one query - cant get SetField to have 2 values, so can only define as SetField[clients:gPolicyid]

                     

                    Also, I note you have written your script as I would prefer, with Capital letters at the start of each word which makes it easier to read, but I'm sure i read in FM that they recommend lower case only.  hopefully I am wrong on this as with Caps is easierto read.

                    • 7. Re: Only some of portal record fields showing.
                      philmodjunk
                        

                      "...cant get SetField to have 2 values, so can only define as SetField[clients:gPolicyid]"

                       

                      Click the second (lower) specify button and enter the second term there.

                       

                      "Also, I note you have written your script as I would prefer, with Capital letters at the start of each word which makes it easier to read, but I'm sure i read in FM that they recommend lower case only.  hopefully I am wrong on this as with Caps is easierto read."

                       

                      Haven't seen that recomendation and I've been designing FMP DB's since FMP 2.5 or so. Not a real issue one way or the other since script steps aren't typed in anyway. You just select the step and then Filemaker's Script Editor adds the step to your script. You have no control over what is or isn't capitalized. If you are referring to my Field Names, then I don't see any advantage to avoiding capital letters. There are several different approaches to naming conventions, but that's all a matter of style choices that can make it easier to identify field types and such when a developer works with a database. It doesn't affect how the database scripts function.

                      • 8. Re: Only some of portal record fields showing.
                        HugoLidia
                          

                        Set Field now corrected - thanks, but Field value in Tabs does not change. 

                        I have client 1, with 2 cars.  If I enter the make of the car for the first policy this remains visible or is the same for the second.  IF I check on the underlying policy table the make has only been updated in one of the two policy records, so it looks like the tab is not in sync

                         

                        Looking at gPolicyID value I see it is constant and does not change with the change of policy.

                        • 9. Re: Only some of portal record fields showing.
                          philmodjunk
                            

                          Yep, If you are going to change policies, you have to tell filmaker that you are changing policies. Thats the purpose of the script trigger.

                           

                          Add a button to your portal row and set it to run this script:

                           

                          Set Field [Clients::gPolicyID; Policies:: PolicyID]

                          Commit Record

                           

                          If the fields on your tab refer to fields from the new table Occurrence, they should update each time you click the button in the portal row to show the related fields from the same record.

                           

                          You can use a conditional format to change the fill color of your fields in the portal row to Highlight the current row so you know which row is the "current" policy.

                          • 10. Re: Only some of portal record fields showing.
                            HugoLidia
                              

                            I have that in the script trigger as you suggested.  (Shame one can't easily copy and paste from the script editor)

                            as the User tabs out of the PolicyType field the OnObjectExit runs the script :-

                             

                            If (policies::policies_type="Cars"

                            Go To Object[ObjectName : "portalcars"  ]

                            Set Field [Clients::gPolicyID; Policies:: PolicyID]

                            Commit Record/Requests[]

                             

                            else if..........(one for each tab)

                             

                            EndIf

                            • 11. Re: Only some of portal record fields showing.
                              philmodjunk
                                

                              Which means that your related fields in the tab will update only if you enter/exit that one field. The button allows you to switch between policies without actually entering/exiting the Policy type field in the portal.

                               

                              If that script isn't updating what shows in the tab, then you need to take a look at what fields are there, and what table occurrence is used to refer to them.

                              • 12. Re: Only some of portal record fields showing.
                                HugoLidia
                                  

                                With these two lines as a separate script and on a button as you suggested the change occurs!  Thanks.

                                 

                                Set Field [Clients::gPolicyID; Policies:: PolicyID]

                                Commit Record/Requests[]

                                 

                                Don't fully understand why it hasn't worked when it is part of the OnObjectExit trigger though.  GUess I should be able to perform the second script automatically so User doesn't have to always select it/click the button. 

                                 

                                 

                                • 13. Re: Only some of portal record fields showing.
                                  philmodjunk
                                    

                                  There are a number of options you can play with to see what works best.

                                   

                                  An objectEnter trigger on the entire portal may be worth investigating.

                                  • 14. Re: Only some of portal record fields showing.
                                    HugoLidia
                                      

                                    A trigger on the whole portal wouldn't work as the portal can have more than one record and the details to be viewed are per record.

                                    1 2 Previous Next