13 Replies Latest reply on Nov 23, 2010 1:05 PM by philmodjunk

    Two Portals on One Layout

    dg3321

      Title

      Two Portals on One Layout

      Post

      I have two separate portals on a layout.  One portal lists income, and the other lists expenses.  They are both given a name so the 'add income' button goes to the income portal and the 'add expense' button goes to the expense portal.  I also have a delete income and delete expense button for each portal.  

      Here is the issue.  Say i have 4 items in the income portal.  When i have one item in the expense portal and i decide to delete that item using the delete expense button, it will delete that one expense.  However, when i click out of the expense portal, all of the sudden, all of the items in the income portal have been deleted as well.  However, when i then go back into the expense portal to enter a new expense, the items that were deleted in the income portal now reappear again.

      Why is this happening and what can i do to resolve it?  

      Note: the income portal, the expense portal, and the overall layout are all related by 'month/year/project name'.

        • 1. Re: Two Portals on One Layout
          philmodjunk

          If they reappear, then they aren't being deleted, rather something is affecting your portal's ability to correctly display them.

          What version of FileMaker?

          If 11, are you using any portal filters?

          I know you've said that they are "all related by 'month/year/project name'", but can you spell that out in more detail? What tables do you have, how are the relationships defined?

          Do you use a script or just a button to delete the portal row? If a script, please post it.

          • 2. Re: Two Portals on One Layout
            dg3321

            I'm using FMP 11 (Advanced) and there are no portal filters.

            There are three tables:

            31Avenue Table - which is an overview of income and expenses and other misc project info for each month of the year.

            31Avenue Income - this is what makes up the income portal on 31Avenue layout.

            31Avenue Expenses - this is what makes up the expense portal on 31Avenue layout.

            All three tables are linked by the project name (31Avenue), the current month and the current year.

            I use a script to delete the portal row:

            Go to Object [Object Name: "31Avenue Rent"]

            Delete Portal Row []

            • 3. Re: Two Portals on One Layout
              philmodjunk

              Try adding a Refresh Window step after Delete Portal Row[]

              • 4. Re: Two Portals on One Layout
                dg3321

                Did that, when i clicked 'delete expense' it still asked if i was sure i want to delete that record, but when i clicked 'ok', i did not delete.

                • 5. Re: Two Portals on One Layout
                  dg3321

                  with regards to the refresh window, do i need to select flush cached join results or flush cached external data?

                  • 6. Re: Two Portals on One Layout
                    philmodjunk

                    I should have looked more closely at your script. I assume your delete portal row button is inside the row of each portal. Thus, there should be no need for go to object. That may change the focus to the portal instead of it's row, preventing the delete from happening.

                    You might take a look at the delete portal row script in my Known Bugs database. It's fully portable, meaning you can import it into a different Filemaker file and not have to make any changes to it and works on any portal whether or not it has a blank bottom row for adding related records. (You do have to know how to pass a script parameter to get it to work as the Parameter list carries the layout and table specific info into the script.)

                    • 7. Re: Two Portals on One Layout
                      dg3321

                      I currently have 2 separate delete portal row buttons b/c i have two separate portals.  The way it's been working is when i click into the row i want deleted, i then click the corresponding 'delete portal row' button.  How do i add a delete portal row button for each row of the portal?

                      • 8. Re: Two Portals on One Layout
                        philmodjunk

                        If you have placed the button on the portal row, then you should see a button for deleting it on every row of your portal where you have a portal record. (Plus one more if you have enabled "allow creation of records..." for the portal's relationship.) You can see this in the various portals of the Known Bugs List file I mentioned earlier.

                        • 9. Re: Two Portals on One Layout
                          dg3321

                          Ok, did that.  And when i have it set up like that, it does not delete anything from the other portal.  While i don't love the look of a delete button on every portal row, i guess it will have to do.

                          • 10. Re: Two Portals on One Layout
                            philmodjunk

                            The purpose of placing the button in the portal row is so that the same mouse click that clicks the button also selects the portal row that you want to delete. If you don't place the button in the row, how does your script know which row to delete?

                            • 11. Re: Two Portals on One Layout
                              dg3321

                              Understood, and clearly that solved my issue.  I just need to create something that aesthetically looks ok then i'll be good to go.

                              • 12. Re: Two Portals on One Layout
                                dg3321

                                what about add portal row button, script translation 'go to: last row' - does that need to be on each portal row, or can i keep that as is, as it currently goes to the object and then creates a new row.

                                • 13. Re: Two Portals on One Layout
                                  philmodjunk

                                  In unsorted portals, newly created records will appear at the bottom. Thus, you don't need it in every row unless the new record is expected to draw some starting value from a portal record that you must first select.

                                  You don't even need an add portal row button. If you open Manage | Database | Relationships, you can double click the line linking your layout's table occurrence with your portal's, then select "Allow creation of records via this relationship" for the portal side of the relationship. Then, you can simply click into the bottom portal row and start entering data to create a new related record in the portal.