5 Replies Latest reply on Nov 26, 2012 11:57 AM by philmodjunk

    Adding or deleting records via portals

    RonJennings

      Title

      Adding or deleting records via portals

      Post

           Still working on the audit project I mentioned in previous posts and we are doing it much more relationally than  I had originally anticipated.  Here is the current challenges

           1) I have a layout (call it Audit_Common) with the basic information that will be captured for ALL of the audits.  At the bottom I have a portal that links to the table where photos are stored (creatively called Photos).  A relationship is established so that each audit (which is serialized) does accurately pull up it's associated photos (also serialized).  I can add photos directly into the Photos table and right now I manually enter the associated audit number for the Audit but the desire is that from the Audit_Common layout, to use a button that will allow the user to take a photo with their iPad or browse to a file on their computer & select a photo, get a dialog confirming they want to keep/use the photo, on a YES the photo is retained and entered into the Photos table with and the Audit number automaticly entered, and the current Audit is refreshed so that you can see the photo in the portal (along with any other photos already taken of course).  On a No response, the photo just taken is discarded, no tables are modified in any way, and we revert to the Audit_Common layout.  

           2) I thought I had the answer for this next one but I turned out to be quite wrong...  Within the area of the portal in Audits_Common that displays the images from Photos, I created a button with a script to (I thought) delete the photo that appears beside it in the the portal.  What actually happens from that button is it deletes the Audit currently being viewed and the photos stay quite intact over in the Photos table.  How do I get the deletion script associated with the correct record (photo) & table?

           3) When I click on an existing photo to view it on an iPad, it brings up a full-size image to view.  But when I click the photo while viewing on a PC/Mac, it just selects the field as if to change/delete the image.  The desired behavior is that clicking on the image brings up the full size for viewing and that the only way to delete a photo would be via the button (or going directly to the Photos table but that table won't be accessable to the users). Not certain if that is possible or not.  Am I needing to lock the photo in some way and add another button that will display the full size?  How would that look?

           Thanks for any help/info. 

           Ron

        • 1. Re: Adding or deleting records via portals
          philmodjunk

               1) if "allow creation of records via this relationship" is enabled for Photos in the relationship on which this portal is based, you can click in the container field and then, in FM Go, an option for taking a picture and inserting it into the container field will appear.

               2) What method did you use with that button to attempt to delete the portal record? Did you use "delete potal row"?

               3) In FileMaker Pro, you'll need to script a button for viewing the image full size. You can use a button with Export Field Contents to open the image file in an image viewing application or you can open a new window with the container field located in the new window but sized to be much larger than that found in the portal row.

          • 2. Re: Adding or deleting records via portals
            RonJennings

                 1 & 3: I'll check on those

                 2) Nope, I had selected Record because I was perciving things within the portal window as being thought of as the Photos table.  Changed it to Portal Row & now getting desired results.

                 Thanks (again) Phil :)

                 Ron

                  

            • 3. Re: Adding or deleting records via portals
              philmodjunk

                   If you want to make that delete portal row operation a touch more user friendly, check out the delete portal row script found in the Known Bugs List Database. It is fully portable--it can be imported error free into any file and can be used on all portals in your file. It highlights the clicked portal row and displays a custom dialog message that includes data from the portal row that you specify for confirmation before deleting the portal row only if the user clicks Ok in this custom dialog. It manages this via a script parameter passed to the script.

              • 4. Re: Adding or deleting records via portals
                RonJennings

                     I'll look at that.

                     Made the relationship change (Item #1) and now adding records as well.

                     Is there an example of the New Window method you mention for Item #3?

                     Thanks

                • 5. Re: Adding or deleting records via portals
                  philmodjunk

                       Go To Related Records has a new window option so in one script step you can pull up the clicked portal record in a new window. If you are using FileMaker 12, you can specify window options to make this a modal window so that the user must close the window before interacting with the original window. The same can be done in FileMaker 11, but requires additional scripting to pull off.