1 2 Previous Next 23 Replies Latest reply on May 10, 2016 11:00 AM by dtcgnet

    Portal filter


      Dear FMP Gurus


      I have a job record with a status: "New", "In progress", etc. This is selected from a pop-up field.

      I have a session record with a portal showing all jobs. This can be filtered by status. This all works fine if I manually select from the pop-up in the job record. Portal filtering works. If I set the field using a set field script step, the portal filtering does not work.


      Why does portal filtering work when the pop-up is set manually but not when set with a script?


      FMP 14


      Thank you


      Chris G

        • 1. Re: Portal filter

          At a guess: there's a trigger on the field that refreshes the portal display. When using Set Field[], the trigger isn't initiated.


          Use a script that combines the Set Field[] with a Refresh Portal step

          • 2. Re: Portal filter

            You probably need a refresh portal step after the set field. When you manually enter the item, you enter the field, insert the value and then exit the field. Set field just places the value in the field no matter if the field is on the layout or not.

            • 3. Re: Portal filter

              Thanks erolst and gordon. That is not the problem. The portal filtering works, script triggers, refreshing. It's all good BUT only if the status field over in "Jobs" was set manually. If the status field in "Jobs" is set with a set field then portal filtering over in "session" no longer works.


              Example. If the status field on jobs record 1 was set manually to "New" and the status field on jobs record 2 was set with a script step also to "New", the portal filter will only show job record 1, but both job records have the same status.

              • 4. Re: Portal filter

                Is a popover involved in this equation, if yes triggers might not work properly if you are trying to set a field that is not in the popover. Does the script debugger indicate that the refresh is occurring?


                Roy Gordon


                Sent from my iPhone

                • 5. Re: Portal filter

                  I'm inclined to agree with erolst and rgordon. After your script does its thing to set the status field to New, then jump into find mode or layout mode, then back to browse mode. That will force a screen refresh without modifying anything else. If the portal looks properly filtered when you return to browse mode, then you just need to refresh the portal (which you should probably be doing anyway). Set the field, then at the end of the script use a:


                  "Refresh Object ["PortalNameHere"]

                  • 6. Re: Portal filter

                    When the field is set via script, it is followed by a commit record step. At the end of the script all cartesian relationships are reset with a set field of the match fields.


                    When the portal is filtered the script trigger also resets the portal relationship.


                    No, there is no pop-over involved in this.


                    It seems to me that unless the status field is set manually, it is not accepted or saved somehow.

                    • 7. Re: Portal filter

                      Where is your refresh portal step in your description?

                      • 8. Re: Portal filter

                        I have to say that the portal filtering works perfectly. If I navigate over to "jobs" and set the status field on each record manually, then navigate back to "session" where the filtered portal lives, it filters perfectly 100%.


                        If I navigate over to "jobs" and use a set field script to set the status field, then navigate back to "session", the portal filtering no longer works properly. I can see all the job records, if I set the portal filter to "New" it will only show the job records where the status field was set manually to "New" and not those that were set to "New" with set field script step.


                        If the filtering did not work it would show all or nothing. It seems to be into selective filtering. "I will only show job records where the status field was set manually. I don't like showing records where the field was set with a script step!"

                        • 9. Re: Portal filter

                          Can you post the calculation that you are using in the portal filtering dialog?


                          Also, can you post a screenshot of the script itself?

                          • 10. Re: Portal filter

                            Good luck in resolving this issue.  Three people have suggested using a refresh portal step but you do not seem to want to acknowledge or try using it.  Can't help if you don't want to follow the help that is give.  If the refresh step doesn't work, that give posters one less thing to consider when trying to help you.

                            • 11. Re: Portal filter

                              Sorry gordon. I have tried the refresh portal step. It did not work.

                              • 12. Re: Portal filter

                                When you set the value manually, is a script being triggered? Are you setting any other values? What is the formula that's filtering the portal? You've got a value called "New" and that's what your testing has been done with. What about if you set it to "In Progress" or one of the other values? Add a "Set Error Capture On" step right after your set field. Then add an If that shows a custom dialog right after that step. The If will be something like:


                                If ( Get ( LastError )

                                Show Custom Dialog "The last error was " & Get ( LastError )

                                End If


                                Something could be going wrong that way, or the value you are setting isn't exactly the same as what is selected via the popup.

                                • 13. Re: Portal filter

                                  Not to belabour the point, but be sure that the portal is actually named and that the name matches the parameter in the Refresh Portal step... the latter has caught me more than once, especially when duplicating portals (where "Copy" is appended to the object name).

                                  • 14. Re: Portal filter

                                    When using a Set field, script triggers might not work the way you think they should work. Instead of using a Set Field, you could try using an Insert Calculated Results followed by a commit or go to next field. This should have the same effect as when you manually enter a value into the field.


                                    Roy Gordon


                                    Sent from my iPhone

                                    1 2 Previous Next