6 Replies Latest reply on May 3, 2013 8:00 AM by ColinJim

    Defining a Report Cover Photo Using a Calculated Container Field



      Defining a Report Cover Photo Using a Calculated Container Field


           Hi all!  I'm a fairly new user (2 months) and have picked up filemaker to help streamline some inspection work (using iPads and filemaker go) and associated reporting that my company is doing.  I've been using this forum a lot but this is my first post.

           Here is the low down.  We are inspecting approximately 100 bridges and at each bridge we take anywhere from 20-40 photos.  I have a table set up for my insepction data which I have related to a photograph table through a field called Bridge_ID.  On my inspection layout (used on the ipad) I have a portal set up to show the photograph table which allows me to add as many photos as I want at each bridge site.

           In creating the reports, I only want to use one of the photos for the cover page.  How I planned to automate this was by creating a photo_tag field in my Photographs table so that I can apply labels such as "cover" or "report" or both.  These labels would be applied through a checkbox set when I get back in the office where I can better determine the quality of the photos.

           When I create a report layout for my cover page and I add the photo field, it shows the first photo recorded associated with the bridge I am reporting.  I want the cover page to display the photo that I apply the label "cover" in the photo_tag field.  I was planning on creating a calculated container field in my inspection data table called c_cover_photo that would populate based on filtering through photos in the photograph table that match both the Bridge_ID AND have the "cover" label applied.

           I'm having trouble determining what the calculation needs to be for me populate my calaculated container field with the contents of the Photo container field in the related Photographs table based on the contents of the Photo_Tag field.

           Perhaps this isn't even the best way to achieve what I want to do.  I am open to all suggestions and can provide clarification to any of my garbled explanation above if required.

           Thanks in advance.  Colin

        • 1. Re: Defining a Report Cover Photo Using a Calculated Container Field

               You don't need the calculation field and it won't work with your setup. There are other ways to show the selected picutre, however:

               Option 1:

               Set up a one row portal to your picture table. Size this one portal row very large and place your container field from the photo table in this portal row. This one row portal can cover your entire layout if that's what you need. Define a portal filter such as:

               Photos::SelectionField = "Cover"

               and your portal will filter out all photos but the one that you have entered the single value "cover" into the selection field.

               Option 2:

               Define a new relationship that only matches to a photo record that has "Cover" in the SelectionField:

               MainTable::__pkBridgeID = Photos|Cover::_fkBridgeID AND
               MainTable::constCover = Photos|Cover::SelectionField

               Photos|Cover is a new table occurrence of your Photos table. constCover is a calculation field that simply returns the text: "Cover". WIth this relationship, you can then add your container field from Photos|Cover and you'll see the selected cover photo on your layout.

          • 2. Re: Defining a Report Cover Photo Using a Calculated Container Field

                 Hello Colin,

                 Looking to above it seems you have 2 tables (Bridge and Photograph).

                 In Bridge table you keep the primary info for a bridge. and in Photograph table you keep multiple photos of bridges.

                 And Bride table and Photograph tables are matched by "Bridge_ID" which should be a primary key in "Bridge" table and foreign key in "Photograph"

                 Now in "Photograph" table there is a checkbox field called "Cover_Photo". If you will check this box then that specific photo will be in cover photo for suppose Bride A among all 20 photos for BrideA

                 You want that cover Photo displayed in Bride profile. Then you need to do below steps to get that.

                 --- Create a field called "ConstantOne" in Bridge table which is a global field with value 1

                 --- Create a relationship between Bridge To Photograph matching keys will be "Bridge_ID_pk" to "Bridge_ID_fk" and "ConstantOne" To "Cover_Photo"

                 Where Bridge is the left side table and Photoghaph is the rightside table. You can name the right side "Photograph" relation ship name as "bridge_Photoghaph_BridgeCoverPhoto" 
                 --- Then create a field in Bridge table as "c_Cover_Photo" a calculated container field and calculation text will be bridge_Photoghaph_BridgeCoverPhoto::Photo
                 --- Then in bridge layout put this "c_Cover_Photo" which will show the cover photo for that bridge.
                 Thanks Elishree
                 FileMaker 11 Certified Developer
                 Senior Software Engineer
            • 3. Re: Defining a Report Cover Photo Using a Calculated Container Field

                   That's awesome.  Thanks to both of you for responding!

                   I'm sure all methods work but I've went with PhilMod Junk's option 1 (filtered portal) as it seems to keep things the simplest.

                   I'm moving on to the body of the report now and I'm sure I'll be back when I inevitably run into problems when trying to display multiple photos with Photo_Tag = "Report".

                   Thanks again,


              • 4. Re: Defining a Report Cover Photo Using a Calculated Container Field

                     Thanks again for the help.  As I surmised, I am having trouble putting together the photo portion of my report.  To summarize my situation for just one of bridges:

                     I have 40 picutres in a Photo table that are related through a Bridge ID to an Inspection table.  I have tagged 13 of the best photos to be in the report as "report" through a check box set in a Photo_tag field in the Photo table.  I am trying to create a layout for a section of the report that displays the photos I have tagged "report".  I want 4 picutres per page in a 2x2 grid.  So in this case I will have three pages of four photos and 1 page of 1 photo and the photo report would be a total of 4 pages.

                     So far I have tried:

                     1) Creating a layout with 4-single record portals per page for five pages (20 total portals).  Each portal would start at a different record (1 to 20).  The portals were filtered as per PhilModJunk's option #1 above for the photo_tag="report".  This would work if I always had 20 "report" photos, but unfortunately some bridges have less and some more.  If they have less then the report prints blank pages for the "recordless" portals, and if they have more I am missing photos.

                     2) Creating a layout with the photo field and performing a find for my Bridge_ID AND Photo_tag="report".  In this case I can get all the records I want to print but they are all stacked vertically (i.e. list mode).  

                     I started to try and implement the solution by Elishree Dey but I realized that would only work for one photo.

                     I should also mention that I am bound to the 2x2 format as one of the client's conditions for allowing me to use filemaker for the inspections was that the reports looked exactly the same as the ones from previous reports prepared using excel.

                     Again, I look forward to any help you can provide.  Perhaps I should start a new topic to get more traffic.


                • 5. Re: Defining a Report Cover Photo Using a Calculated Container Field

                       Set the portals, not the fields in the portals, to "slide up" / "Resize enclosing part". In preview mode and when printing, this will eliminate the empty space of unsused portals.

                  • 6. Re: Defining a Report Cover Photo Using a Calculated Container Field

                         Thanks Phil, the use of portals was actually not the way for me as the photos were actually related to element records (bridge deck, bridge barrier etc.) therfore the report would create a report for each element instead of one for the bridge (confusing I know).

                         But in the end, you helped through a post on a different thread (screen shot posted to the bottom).  It works perfect for what I am doing.  If anyone else is going through this thread, the key is to follow the instructions below and modify the layout setup to print in however many columns you want.

                         I'm having only one problem that I am going to start searching a solution for now, but in the event that someone happens to read this and the answer is a quick one liner I'll post the question anyway: How to I get the header and footer to span both of my columns?

                         Thanks again Phil.