9 Replies Latest reply on Apr 14, 2015 10:12 AM by SueMcGovern

    Portal Button to Display a record

    SueMcGovern

      Title

      Portal Button to Display a record

      Post

      I have a Product table (P) with an associated Work table (W) that stores all the working data associated with each product (images, pdfs, media etc).  Both tables are linked using the product primary key.  P=W.

      On the main product layout, I have setup a layout tab that is divided into two columns: the first column displays a portal list of all the working records from W, and I want the second column to the right to display the full details of a working record selected from a portal row using a button click.  If I use GTRR in an attempt to display the working record I receive an error message because the layout is based on the product table, not the work table and this cannot be changed.  Since I am now am completely stuck, would very appreciate some help, thanks.

       

        • 1. Re: Portal Button to Display a record
          SteveMartino

          I don't understand what a layout tab is, and how it's divided into columns. Could you post a pic?

          If I understand, you probably need a second table occurrence of the W table to show the details, related to the first W table.  Then clicking on a button in a portal row should capture the primary ID, enter find mode, set the primary key ID on the detail tab panel (or wherever it is) and perform find.

          See if this is on the right track

          https://dl.dropboxusercontent.com/u/71328624/Sample1%20%282%29.zip

          U/N:  admin

          PW:  1234

          • 2. Re: Portal Button to Display a record
            philmodjunk

            Instead of GTRR, create a second Tutorial: What are Table Occurrences? of W

            W|Selected------P-----<W

            P::__pkProductID = W::_fkProductID
            P::_fkWorkID = W|Selected::__pkWorkID

            Set up a button inside the portal row that does this:

            Set Field [P::_fkWorkID ; W:__pkWorkID ]
            Commit Records ---> you may not need this step. Add it if the layout doesn't update until you click a blank area of the layout

            Then add fields to your layout from W|Selected and they will update to show data from the selected W record when you click its portal row button.

            • 3. Re: Portal Button to Display a record
              SueMcGovern

              Thanks Phil and Steve for your input, unfortunately I have been going round in circles on this most of today.  Steve, the example you sent is exactly what I wish to do however the layout is based on the products table whereas my table is based on a completely different file.  Which seems to be making everything really tricky, for me anyway.  I did finally manage to get it to display the record from the portal using a global join and having a portal list on one side of the screen and a single portal display on the other side that shows the selected record.  However when I click the portal to create a new record, two records are being created, not one!  Ugh!  So, I removed the add record option from the portal list occurrence and put a create record button on the layout but that lead to all sorts of difficulties so this was finally abandoned.  I don't understand why I am having so much trouble with this, I know it must be something basic I am doing wrong but I cannot find the issue.  Clearly I need to go back to words of one syllable.......

              • 4. Re: Portal Button to Display a record
                philmodjunk

                It doesn't sound like you tried my suggested approach--which is quite different from what Steve recommended.

                However when I click the portal to create a new record, two records are being created, not one!

                Not really. From here, it sounds like you were confusing the blank "add row" that is a standard feature of FileMaker Portals when the "allow creation of records via this relationship" option is enabled. This appears to be an additional blank row in your portal and is put there precisely so you can add new records by entering data into this bottom blank row in your portal.

                • 5. Re: Portal Button to Display a record
                  SueMcGovern

                  I'm sorry Phil, I did try your suggestion but am not quite sure I followed what you were saying correctly.  Steve sent an example which was much easier to follow but didn't work correctly anyway because it didn't really match my scenario.  So it ended up being a cross between the two.  As for the duplicate records, no, I am not getting confused with the blank row in the portal for that line is coded to prompt the user to add a new record.  Furthermore, I checked the table and took the script through debug so confirm two records are definitely being created.   

                  • 6. Re: Portal Button to Display a record
                    philmodjunk

                    Then you will need share some details of your current design if you want assistance with it as it would appear that you have come up with your own design to resolve your problem. wink

                    • 7. Re: Portal Button to Display a record
                      philmodjunk

                      If I understand this correctly...

                      Your layout specifies "Appraisal" in Layout Setup | Show Records from.

                      Your portal set up specifies "Appraisal Documentation" for the portal where you want your mouse click to show details about the record in that portal row.

                      And the container field shown in the center of your layout is a field from Appraisal Docs | Selected.

                      If so, then the script shown does not seem at all correct as the script would be:

                      Set Field [Appraisal::Appraisal Doc Relate ; Appraisal Documentation::_Appraisal Image ID ]
                      Commit Records

                      Note that no portal is needed for this container field. It can just be the container field selected from the Appraisal Docs | Selected table occurrence. (in the dialog where you select the field to add to the layout, select this name from the drop down at the top before selecting the container field to add to the layout.

                      • 8. Re: Portal Button to Display a record
                        philmodjunk

                        BTW, is there a way to copy script and paste externally?

                        If you mean in order to post a script here as text:

                        To post a script to the forum:

                               
                        1. You can upload a screen shot of your script by using the Upload an Image controls located just below Post a New Answer.
                        2.      
                        3. You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
                        4.      
                        5. If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
                        6.      
                        7. If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
                        • 9. Re: Portal Button to Display a record
                          SueMcGovern

                          Thanks Phil, I had to leave this for a day or so because I could not see the forest for the trees!  All works perfectly now, appreciate your help.  S.