10 Replies Latest reply on Mar 28, 2014 2:50 AM by tunesmith

    Clear Portal Row?

    tunesmith

      Title

      Clear Portal Row?

      Post

           Hi, what is the easiest way to clear a portal row without deleting the related record?

           For instance (making up an example here), say a Widget can have many Customers, and a Customer can have many Widgets.  On the Widget page, I have a portal of Customers. 

           Widget 1 has Customers 1 and 2.

           Widget 2 also has Customers 1 and 2.

           I want to delete Customer 2 from Widget 1's portal.  But I don't want to delete the Customer 2 record, because Widget 2 has it.

           In other words, I'm looking for how to highlight a row in portal, and then delete the row from the linking table in between the Widget and Customer tables, without deleting any Widget or Customer records themselves.

           (This is hard to google for, because "delete relationship" invariably talks about deleting the entire linking table from the relationship graph, while "delete portal row" always talks about deleting the actual related record; neither of which I want.)

        • 1. Re: Clear Portal Row?
          GuyStevens

               You are missing a table.

               Because you are talking about a many to many relationship.

               How will you relate Customer 1 to both widgets and Customer 2 as well?

               It's not possible without a join table.

               That's a table that contains the Customer ID and the Widget Id.

               And in your case you would have 4 records in that join table:

               Widget 1 Customer 1
               Widget 2 Customer 1
               Widget 1 Customer 2
               Widget 2 Customer 2

               And then you can just delete whichever one you don't want anymore.

               Greetings

               Guy

          • 2. Re: Clear Portal Row?
            delibebek

                 I automate this process so I'm not manipulating any records directly from the portal. I include an "x" at the end of each portal row with a script attached. The script runs a find in another window and prompts the user to delete or stop (with a nice disclaimer that the "widget" is not itself deleted). The script then deletes the join record, which removes it from the portal neatly.

            • 3. Re: Clear Portal Row?
              tunesmith

                   Yes, I understand that - I referred to the linking table (or joining table) above.

                   So, imagine the Widget layout.  It has a Portal to customers, and it shows two customers.  How, from that portal, can I delete "Widget 2 Customer 2" from that joining table, without deleting the Customer 2 record itself?

                    

              • 4. Re: Clear Portal Row?
                tunesmith

                     Matt, that sounds like a good approach.  I haven't done a script before - how would I refer to the correct customer ID and Widget ID in that script?

                     It's too bad this isn't supported out of the box, it seems like a common use case... Bento supported it easily.

                      

                • 5. Re: Clear Portal Row?
                  GuyStevens

                       Hi Tunesmith. It is a very common use case and it is used all the time.

                       It is supported out of the box. You just aren't doing it right  :p

                       You don't base your portal on the customers table. But on the Join table.

                       I'll make you a quick video to explain.

                       Greetings

                       Guy

                  • 6. Re: Clear Portal Row?
                    tunesmith

                         Oh my gosh!  Thanks, Guy.  That is the light bulb - I didn't realize I could just pull in a "CustomerWidget" portal and then refer to the Customer names from there rather than the ids in the join table.  I can put a button on each row to "delete portal row" without a dialogue box, too.

                          

                    • 7. Re: Clear Portal Row?
                      tunesmith

                           Although... I'm not sure if, from that Widget1 record, I can a) create a new Customer4 from that portal, or b) select an already-existing Customer3... still messing with it.  :-)

                      • 8. Re: Clear Portal Row?
                        GuyStevens

                             Damn Filemaker Forum, just lost my post  :(

                             Anyway, check this out:

                        http://youtu.be/hRVnQTVbbh8 

                             Greetings

                             Guy

                        • 9. Re: Clear Portal Row?
                          GuyStevens

                               You could add a script that allows you to create a new customer directly from within the widget layout, but that can't be done directly.

                               But if you are a little clever in coming up with a script that shouldn't be a problem. ;) 

                          • 10. Re: Clear Portal Row?
                            tunesmith

                                 Thanks again Guy!  I'm sure I'll review that a few times in the next few days.  A perfect bit of mind-expansion there.  ;-)