4 Replies Latest reply on Feb 9, 2012 4:34 PM by veramilo_1

    Get feedback when clicking in an empty portal row

    veramilo_1

      Title

      Get feedback when clicking in an empty portal row

      Post

      I have a portal with a button to go to the related record, and 3 large portal rows displayed (it isn't always obvious that it's an empty portal).  Is there anything I can do to detect if someone clicks a button in an empty portal row, expecting something to happen, so I can display a dialog telling them why what they may expect to happen isn't happening?  Thank you.

        • 1. Re: Get feedback when clicking in an empty portal row
          philmodjunk

          Unless you have selected "allow creation of records via this relationship" there will be no button in the empty portal row to click. Thus, one solution is to disable this option in the relationship to keep there from being a button to click in the first place.

          Another option is to include an If step that checks the portal table's foreign key field for data and proceeds only if it is not empty:

          If [Not IsEmpty ( PortalTable::_fk_ParentID ) ] // This can be simplified to just [Not PortalTable::_fk_ParentID if field is of type number
            #Put the rest of your script here
          End IF

          You can also use conditional formatting to make the button's text appear grey and thus give it a "disabled" look when the button is in this last blank "add record" row. If the button is strictly layout text, you can even make the button invisible by using conditional formatting to change the text size to 500.

          • 2. Re: Get feedback when clicking in an empty portal row
            veramilo_1

            The second options seems the only viable one for my situation, but it isn't working.  I added a step to display a dialog if the button is clicked in an empty row but nothing happens (I tried with both the foreign & primary key for the portal).

            Fortunately, this isn't a critical feature to add, but it seems it may have helped minimize some potential frustration.

            Thank you for your time!

            • 3. Re: Get feedback when clicking in an empty portal row
              philmodjunk

              By any chance, is your "empty" portal row not really empty? If you have a record in the portal, but all visible fields are empty, the row will look empty, but there's really a record there and then the above script will not display a dialog.

              Other things you can try:

              If you have FileMaker Advanced, enable the script debugger and data viewer and click the button when on the empty portal row. Check to see what value is in the field used in the If step.

              If you do not have advanced, add a show custom dialog at the beginning of your script and use it to display the value of the field you are using in your If step to see what value appears. You can also but the exact expression from your If step inside the dialog and check to see if the dialog shows a 1 (True) or 0 ( False ).

              • 4. Re: Get feedback when clicking in an empty portal row
                veramilo_1

                I am SO sorry -- it was very late when I was working on your original suggestion and I never assigned the script to the button.  I noticed today and corrected that and now it works perfectly.  Thank you for your time and help.