10 Replies Latest reply on Jun 18, 2012 3:56 PM by disabled_JackRodgers

    Can I Avoid a Layout View Change?

    RodrigoPerez

      Title

      Can I Avoid a Layout View Change?

      Post

      Hi!  i'm still working on my Projects database and have another question.

      In the Projects layout there is a portal that shows the Tasks associated with that Project.  I have added a '+' and '-' button that allows the user to add a new Task to or to delete an existing Task from the Project.  When adding a new task, the user's view of the Project layout never changes.  The new task simply appears in the portal; however, when I'm deleting a task, the user's view switches to the Task table for the actual deletion of the record.  Is there a way to hide this part of the deletion process?

      Here is my simple deletion script:

      Delete Task Record Script

      If [ Get ( ActivePortalRowNumber ) > 0 ]
      Go to Related Record [ From table: “Task Table”; Using layout: “Task Table” (Task Table) ]
      Set Selection [ Task Table::Task Description ]
      Delete Record/Request
      Go to Layout [ original layout ]

      End If 

      I added the Set Selection so that the user can see which record is about to be deleted, before responding to the confirmation dialogue.  Also, I have not enabled the option to allow for deletion of records in the portal as I want this handled by the button and not directly by the user.

      Any assistance with how to hide the layout change would be very much appreciated!  Thanks in advance.

        • 1. Re: Can I Avoid a Layout View Change?
          philmodjunk

          You can add a Freeze Window at the beginning of the script and the fact that you change layouts will not be visible to the user. If there are layout based script triggers being tripped by the change in layouts, there's a way to disable them.

          For an alternative approach to deleting portal rows, you can check out the script found in the Known Bugs List database. It's designed so that you can import it error free into any FileMaker file. (The key data specific to your file and layout is passed as a script parameter.)

          • 2. Re: Can I Avoid a Layout View Change?
            LaRetta_1

            "Also, I have not enabled the option to allow for deletion of records in the portal as I want this handled by the button and not directly by the user."

            Hi Rodrigo,

            What script is attached to the button determines the User experience.  There is no need to leave the portal at all - the row they click will be the row deleted.  If you wish to display the line being deleted then script it as:

            Set Selection[ Task Table::Task Description ; start position: 1 ; end position ; Length ( Task Table::Task Description ) ]
            Set Error Capture [ on ]

            Delete Record/Request [ ]

            You could also use Go To Field [ select/perform ; Task Table::Task Description ] instead of Set Selection[].

            • 3. Re: Can I Avoid a Layout View Change?
              RodrigoPerez

              Thanks for the info, folks!

              • 4. Re: Can I Avoid a Layout View Change?

                No one mentioned the easiest idea of all...put a delete button on the portal record and use the Delete Portal Row function found in the Records view in the list on the left.

                None of the complicated ideas above are needed to delete one portal row.

                • 5. Re: Can I Avoid a Layout View Change?
                  LaRetta_1

                  I agree, Jack but script is needed instead of button if Rodrigo wants to also highlight the Description as well which is why I provided script  Either Delete Record[] or Delete Portal Row[] will accomplish the task within a script ... there is no need to go to another layout just to delete a related record.

                  The subject was 'can I avoid layout switch' and the answer is yes. :^)

                  • 6. Re: Can I Avoid a Layout View Change?
                    RodrigoPerez

                    I'll have to experiment with your example methods a bit to see which way I like to do it best, but my main goal is to have the user only use the '+' and '-' buttons that I have provided to add and delete tasks.  I'm just trying to keep the UI simple and the workflow simplified so that the user doesn't have to learn about "five" different ways to accomplish the same task of adding or removing a record.

                    Thanks again for your input!

                    • 7. Re: Can I Avoid a Layout View Change?

                      The button ON the portal row with Delete Portal Row is the easiest.

                      If the user wants to see the actual record BEFORE deleting it then use

                      GTTR related record (select your layout) in a new window.

                      The delete button script will then be

                      Delete record

                      Close Window

                      To simple for words...

                      If they con't want to delete the record then a Cancel button would be

                      Close window.

                      Both closes take you back to the original record.

                      12 now lets you select a modal window which prevents some of the new window all over the place features.

                      • 8. Re: Can I Avoid a Layout View Change?
                        philmodjunk

                        The main problem with a straight forward, unscripted delete portal row is that it can be cryptic to the user. "Master record", "Related record"????

                        I prefer a system where actual data from the selected portal row is displayed in the confirmation dialog and with the portal row highlighted for additional confirmation. Since I've been able to set up a script that will work with any layout in any file, this took some work to set up originally, but is now very easy to implement anywhere I need a delete portal row script.

                        • 9. Re: Can I Avoid a Layout View Change?
                          LaRetta_1

                          Jack said, "The button ON the portal row with Delete Portal Row is the easiest."

                          That is what we are talking about, Jack - the delete script button MUST be on the row or else you must capture the ID and go to the other layout to delete it.  Usually an Add button is placed above the portal but the delete is within the row.

                          Now YOU are making it more complex than it need be, LOL.  Delete Record and Delete Portal Row[] both provides dialog allowing User to cancel - just as I showed on my Delete Record[] ... nothing inside the brackets means that it does not 'perform without dialog.'

                          There are many approaches here which work.

                          • 10. Re: Can I Avoid a Layout View Change?

                            To capture the ID of a portal row you have to click on it, right?

                            So click on the row, click a button, etc.. kinda the same.

                            Now if you DON't want to immediate delete the row (using a Delete Portal Button on the Portal Row) and instead want to LOOK at the record before deleting it, then just use the GTTR button I mentioned above which takes you to the layout WITHOUT COMPLEX SCRIPTING...

                            Sometimes we get so wrapped up in SCRIPTING we forget how easy it could be...  :)