12 Replies Latest reply on Mar 30, 2012 9:35 AM by philmodjunk

    Picker Not Working

    NaturSalus

      Title

      Picker Not Working

      Post

       

      Without any success I have been trying to appply PhilModJunk enhancedvalueselection demo to my project. Certainly, I must be missing something quite obvious that I am not able to spot.

       

      TABLES

      Tables:

      • Person
      • StorageUnit
      • PersonStorageUnit (join table)

       

       

      TABLE OCCURRENCES

       

      Table Occurrences:

      • StorageUnit TO of StorageUnit table
      • storageUnit_USER TO of PersonStorageUnit table
      • storageUnit_user_PERSON TO of Person
      • Selection_storageUnit_user_PERSON TO of Person

       

      RELEVANT FIELDS

       

      Person table fields:

      • __kp_Person
      • NameFirst
      • NameLAst
      • NameFirstLast
      • PersonRefresh

       

      StorageUnit table fields:

      • __kp_StorageUnit
      • StorageUnitName
      • gSearchField

       

      PersonStorageUnit table fields:

      • __kp_PersonStorageUnit
      • _kf_Person
      • _kf_StorageUnit

       

      StorageUnit::gSearchField  field is a global Text field

       

       

      Person::PersonRefresh field

       

      Person::Personfresh (text). Auto enter calculation. Select: Do not replace existing value of field (if any).

      Evaluate this calculation form the context of: Person

      Calculation: Person::PersonRefresh = StorageUnit::gSearchField. Calculation result must be Text. Select: Do not evaluate if all referenced fields are empty.  

       

      RELATIONSHIPS

      Relationships:


      storageUnit_user_PERSON::__kp_person =  storageUnit_USER::_kf_Person

      Allow creation and delete records on the  storageUnit_USER side

       

      storageUnit_USER::_kf_StorageUnit = StorageUnit::__kp_StorageUnit

       Allow creation and delete records on the storageUnit_USER side

       

      Selection_storageUnit_user_PERSON::PersonRefresh X StorageUnit::gSearchField

       

      LAYOUTS

       

      Layouts:

      StorageUnit_Detail based on the StorageUnit TO

      Person_Detail based on the Person TO

      PersonOfSU_Selection based on the storageUnit_user_PERSON TO 

       

      StorageUnit_Detail 

       

      On the StorageUnit_Detail layout there is a Portal to the storageUnit_USER TO that has the following fields:

      storageUnit_USER::_kf_person

      storageUnit_user_PERSON::NameFirstLast

       

      On the StorageUnit_Detail layout there is also the Select button that triggers the LaunchPersonSelection script

       

       

      PersonOfSU_Selection

       

      On the PersonOfSU_Selection layout  there is a Portal to the Selection_storageUnit_user_PERSON TO that has the following fields:

      Selection_storageUnit_user_PERSON::__kp_person

      Selection_storageUnit_user_PERSON::NameFirstLast

      The filter of the Portal to the Selection_storageUnit_user_PERSON TO is the following:

      IsEmpty ( StorageUnit::gSearchField)  or PatternCount (Selection_storageUnit_user_PERSON::NameFirstLast ; StorageUnit::gSearchField )

      The two portal fields trigger the PersonOfSU_Selection Portal Script

       

      On the PersonOfSU_Selection layout there is also the StorageUnit::gSearchField that OnObjectModify triggers the Update Search script.

       

      On the PersonOfSU_Selection layout there is also the Cancel button that triggers the Cancel Selection script.

       

       SCRIPTS


      Cancel Selection Script

      # Error Handling
      Allow User Abort [ Off ]
      Set Error Capture [ On ]
      #
      Close Window [ Current Window ]
      Halt Script

       

      Update Search Script

      # Error Handling
      Allow User Abort [ Off ]
      Set Error Capture [ On ]
      #
      Set Field [ StorageUnit::gSearchField; StorageUnit::gSearchField ]

       

       

      Launch Person Selection Script

      # Error Handling
      Allow User Abort [ Off ]
      Set Error Capture [ On ]
      #
      Commit Records/Requests
      #
      # Add ParentName
      New Window [ Name: "Person Selection"; Height: 400; Width: 600; Top: Get ( WindowTop ) + 132; Left: Get ( WindowLeft ) + 86 ]
      Go to Layout [ “PersonOfSU_Selection” (storageUnit_user_PERSON) ]
      Show/Hide Status Area
      [ Lock; Hide ]
      Adjust Window
      [ Resize to Fit ]
      # script paused so that the user can make his selection
      Loop
      Pause/Resume Script [ Indefinitely ]
      End Loop
      Exit Script [ ]

       

       

      PersonOfSU_Selection PortalScript

      # Error Handling
      Allow User Abort [ Off ]
      Set Error Capture [ On ]
      #
      Set Variable [ $SelectedPersontID; Value:Selection_storageUnit_user_PERSON::__kp_Person ]
      Set Variable [ $StorageUnitID; Value:StorageUnit::__kp_StorageUnit ]
      Freeze Window
      Go to Layout [ “dev_PersonStorageUnit” (storageUnit_USER) ]
      New Record/Request
      Set Field [ storageUnit_USER::_kf_Person; $SelectedPersonID ]
      Set Field [ storageUnit_USER::_kf_StorageUnit; $StorageUnitID ]
      Go to Layout [ “StorageUnit_Detail” (StorageUnit) ]

       

      After creating several Person records and a new StorateUnit record and triggering the Launch Person Selection Script I end up in the PersonOfSU_Selection layout with no Person records on the Portal.

       

      Although I tried to reproduced PhilModJunk enhancedvalueselection demo I did something wrong that I can't spot.

      Any clues about how to troubleshoot it?

       

      Thanks

       

      natursalus

       

       

       

       

       

       

       

       

       

       

      person.jpg

        • 1. Re: Picker Not Working
          philmodjunk

          I'm trying to map out your relationships from the above post. I can reconstruct these:

          storageUnit_user_PERSON-----+<storageUnit_USER::_kf_Person

          storageUnit_user_PERSON::__kp_personstorageUnit_USER::_kf_Person

          Selection_storageUnit_user_PERSON>----X------<StorageUnit

           

           

           

           

          Selection_storageUnit_user_PERSON::PersonRefresh X StorageUnit::gSearchField

          But then you post:

          On the StorageUnit_Detail (StorageUnit) layout there is a Portal to the storageUnit_USER TO that has the following fields:

          From what I have reconstructed, either there's a mistake in what you posted or you have an additional relationship that you have not posted here as from the above info, they are not linked in a relationship.

          It might help to capture a screen shot of Manage | Database | relationships, cropped down to just these TO's and then use the controls below Post A answer to upload that image to clarify what relationship exist.


          • 2. Re: Picker Not Working
            NaturSalus

            Hello Phil,

             

            Thanks for looking into my question.

             

            First of all the picture

            • 3. Re: Picker Not Working
              NaturSalus

               

              The whole idea is to select a list of users for a specific StorageUnit.

               

               

              Maybe this will clarify the relationships:

               

              TABLES

              Tables:

              • Person
              • StorageUnit
              • PersonStorageUnit (join table)

               

              Table Occurrences:

              • StorageUnit TO of StorageUnit table
              • storageUnit_USER TO of PersonStorageUnit table
              • storageUnit_user_PERSON TO of Person
              • Selection_storageUnit_user_PERSON TO of Person

              RELATIONSHIPS

              Relationships:


              storageUnit_user_PERSON::__kp_person =  storageUnit_USER::_kf_Person

              Allow creation and delete records on the  storageUnit_USER side

               

              storageUnit_USER::_kf_StorageUnit = StorageUnit::__kp_StorageUnit

               Allow creation and delete records on the storageUnit_USER side

               

              Selection_storageUnit_user_PERSON::PersonRefresh X StorageUnit::gSearchField

               


              • 4. Re: Picker Not Working
                philmodjunk

                What portal filter did you assign to the portal?

                From your relationships map, the pop up window should switch to a layout based on StorageUnit and the portal should refer to Selection_StorageUnit_User_Person. As you want to list all person records in this portal until you start entering search text to narrow down the list to just those matching your filter expression.

                • 5. Re: Picker Not Working
                  NaturSalus

                   

                  From your relationships map, the pop up window should switch to a layout based on StorageUnit and the portal should refer to Selection_StorageUnit_User_Person. As you want to list all person records in this portal until you start entering search text to narrow down the list to just those matching your filter expression.

                  Great this sorted out my problem of not getting the list of people on the pop up window

                   

                  What portal filter did you assign to the portal?

                   

                  The filter of the Portal to the Selection_storageUnit_user_PERSON TO is the following:

                  IsEmpty ( StorageUnit::gSearchField)  or PatternCount (Selection_storageUnit_user_PERSON::NameFirstLast ; StorageUnit::gSearchField )

                  The two portal fields trigger the PersonOfSU_Selection Portal Script

                   

                  On the PersonOfSU_Selection layout there is also the StorageUnit::gSearchField that OnObjectModify triggers the Update Search script.

                   

                  On the PersonOfSU_Selection layout there is also the Cancel button that triggers the Cancel Selection script.

                   

                   

                   

                   

                  A new problem that I am having is that the selected name is not incorporated on the Portal to the storageUnit_USER TO that is on  StorageUnit_Detail layout

                   

                  On the StorageUnit_Detail layout there is a Portal to the storageUnit_USER TO that has the following fields:

                  storageUnit_USER::_kf_person

                  storageUnit_user_PERSON::NameFirstLast

                   

                  On the StorageUnit_Detail layout there is also the Select button that triggers the LaunchPersonSelection script

                   

                   

                  Another strange thing that I am noticing is that after selecting a name from the list on the pop up menu I get back to the StorageUnit_Detail layout but I cannot select Status ToolBar from the View menu and the whole file is locked and I cannot close Filemaker, so that I have to reboot my PC.

                   

                  I would say that something strange is going on with the above mentioned scripts.

                  I don't have any other scripts since this is the starting of a new project.

                   

                  Any ideas why Filemaker gets locked out?

                   

                  Thanks,

                   

                  natursalus

                  • 6. Re: Picker Not Working
                    NaturSalus

                    No problem in uploading the file since it is the start of a new project, if you are curious.

                     

                    Thanks,

                     

                    natursalus

                    • 7. Re: Picker Not Working
                      philmodjunk

                      If you check the values in the table, You are probably getting new records in the join table that have a person ID but a mising or incorrect storage unit ID.

                      The reason is that you open a new window and change layouts before you capture the Storage unit ID in a variable so that value or the wrong value may be what is getting entered into the variable.

                      Change:

                      Set Variable [ $StorageUnitID; Value:StorageUnit::__kp_StorageUnit ]

                      to

                      Set Variable [ $$StorageUnitID; Value:StorageUnit::__kp_StorageUnit ]

                      and put it at the beginning of the Launch Person Selection Script. (delete the original script step.)

                      Then update PersonOfSU_Selection PortalScript to refer to $$StorageUnitID when creating the new join record.

                      As to why you are getting locked out. Your launch script is still paused. Add a "Halt Script" step at the end of the PersonOfSU_Selection PortalScript just like you did in the Cancel script to terminate the pause in the launching script.

                      • 8. Re: Picker Not Working
                        NaturSalus

                        Hello Phil,

                         

                        If you check the values in the table, You are probably getting new records in the join table that have a person ID but a mising or incorrect storage unit ID.

                        You are right

                         

                        Change:

                        Set Variable [ $StorageUnitID; Value:StorageUnit::__kp_StorageUnit ]

                        to

                        Set Variable [ $$StorageUnitID; Value:StorageUnit::__kp_StorageUnit ]

                        and put it at the beginning of the Launch Person Selection Script. (delete the original script step.)

                         

                        If I understood you right, you mean

                         

                        To go from:

                        Launch Person Selection Script

                        # Error Handling
                        Allow User Abort [ Off ]
                        Set Error Capture [ On ]
                        #
                        Commit Records/Requests
                        #
                        # Add ParentName
                        New Window [ Name: "Person Selection"; Height: 400; Width: 600; Top: Get ( WindowTop ) + 132; Left: Get ( WindowLeft ) + 86 ]
                        Go to Layout [ “PersonOfSU_Selection” (storageUnit_user_PERSON) ]
                        Show/Hide Status Area [ Lock; Hide ]
                        Adjust Window [ Resize to Fit ]
                        # script paused so that the user can make his selection
                        Loop
                        Pause/Resume Script [ Indefinitely ]
                        End Loop
                        Exit Script [ ]

                         

                        To

                        Launch Person Selection Script
                        # Error Handling
                        Allow User Abort [ Off ]
                        Set Error Capture [ On ]
                        #
                        Set Variable [ $$StorageUnitID; Value:StorageUnit::__kp_StorageUnit ]
                        Commit Records/Requests
                        #
                        # Add ParentName
                        New Window [ Name: "Person Selection"; Height: 400; Width: 600; Top: Get ( WindowTop ) + 132; Left: Get ( WindowLeft ) + 86 ]
                        Go to Layout [ “PersonOfSU_Selection” (storageUnit_user_PERSON) ]
                        Show/Hide Status Area [ Lock; Hide ]
                        Adjust Window [ Resize to Fit ]
                        # script paused so that the user can make his selection
                        Loop
                        Pause/Resume Script [ Indefinitely ]
                        End Loop
                        Exit Script [ ]
                         

                        Is this correct?

                         

                        Then update PersonOfSU_Selection PortalScript to refer to $$StorageUnitID when creating the new join record.

                         

                        If I understood you right, you mean

                         

                        To go from:

                         

                        PersonOfSU_Selection PortalScript

                        # Error Handling
                        Allow User Abort [ Off ]
                        Set Error Capture [ On ]
                        #
                        Set Variable [ $SelectedPersontID; Value:Selection_storageUnit_user_PERSON::__kp_Person ]
                        Set Variable [ $StorageUnitID; Value:StorageUnit::__kp_StorageUnit ]
                        Freeze Window
                        Go to Layout [ “dev_PersonStorageUnit” (storageUnit_USER) ]
                        New Record/Request
                        Set Field [ storageUnit_USER::_kf_Person; $SelectedPersonID ]
                        Set Field [ storageUnit_USER::_kf_StorageUnit; $StorageUnitID ]
                        Go to Layout [ “StorageUnit_Detail” (StorageUnit) ]
                         
                        To
                         
                        PersonOfSU_Selection PortalScript

                        # Error Handling
                        Allow User Abort [ Off ]
                        Set Error Capture [ On ]
                        #
                        Set Variable [ $SelectedPersontID; Value:Selection_storageUnit_user_PERSON::__kp_Person ]
                        Set Variable [ $StorageUnitID; Value:StorageUnit::__kp_StorageUnit ]
                        Freeze Window
                        Go to Layout [ “dev_PersonStorageUnit” (storageUnit_USER) ]
                        New Record/Request
                        Set Field [ storageUnit_USER::_kf_Person; $SelectedPersonID ]
                        Set Field [ storageUnit_USER::_kf_StorageUnit; $$StorageUnitID ]
                        Go to Layout [ “StorageUnit_Detail” (StorageUnit) ]

                         

                        Is this correct?

                         

                        When doing this way I have noticed that in the join table dev_PersonStorageUnit I get a value for the StorageUnit ID (_kf_StorageUnit) but I don't get any value for the Person ID (_kf_Person)

                        Consequently I am not getting incorporated the selected person in the Portal to the   Selection_storageUnit_user_PERSON TO

                         

                        Thanks,

                         

                        natursalus

                         

                        • 9. Re: Picker Not Working
                          philmodjunk

                          If you have advanced, enable the script debugger and data viewer just before selecting a person from the picker. Step through the script and see if $SelectedPersonID ever gets a value.

                          When I review your listing I see

                          Set Variable [ $SelectedPersontID; Value:Selection_storageUnit_user_PERSON::__kp_Person ]

                          used to capture the value and:

                          Set Field [ storageUnit_USER::_kf_Person; $SelectedPersonID ]

                          is used to assign the ID to the join table's kf field. If that one letter difference in the variable name exists in your actual script, it would explain why this script is failing to work.

                          • 10. Re: Picker Not Working
                            NaturSalus

                             

                            When I review your listing I see

                            Set Variable [ $SelectedPersontID; Value:Selection_storageUnit_user_PERSON::__kp_Person ]

                            used to capture the value and:

                            Set Field [ storageUnit_USER::_kf_Person; $SelectedPersonID ]

                            is used to assign the ID to the join table's kf field. If that one letter difference in the variable name exists in your actual script, it would explain why this script is failing to work.

                            You are right there was an error on my part. But, even after removing the "t" the script is not working. Yes the $SelectedPersonID ever gets the right value but is not added to the Portal.

                            At this point, I wonder if a list view based picker is a better alternative for me. Can't even understand why the scripts in your demo are not working as such in my project since the relationships in my project and your demo are identical.

                            Thanks

                            • 11. Re: Picker Not Working
                              philmodjunk

                              Is $SelectedPersonID getting the correct value? I can't tell from your post.

                              Do you have advanced? IF so, do you see any error codes appear in the bottom of the debugger when you step through your script?

                              • 12. Re: Picker Not Working
                                philmodjunk

                                You can click the trash can icon to delete a post you have already posted.