6 Replies Latest reply on Feb 6, 2013 7:26 AM by jfalberg

    pre-determining if relationship record exists



      pre-determining if relationship record exists


           In an effort to save some response time, I am preloading into my results tab which displays in a portal all my records from the answer table and showing details of each record the portal is looking at.  One of them is a 1 to 1 relationship with answer & CFQCase which at least gets retrieved automatically for the first record of answer only.  What I want to do is if I scroll from the first records to the next or any other in the list, I want to at least perform a check (probably add a calculation field on answer) to determine if the corresponding CFQCase record already exists for that selected answer record.  If it already does then do nothing, otherwise perform a script to call the external web service to retrieve the necessary records associated with CFQCase and other related tables.  Since my established relation is Answer.MessageNumber = CFQCase.MessageNumber I wonder if it that easy to determine the CFQCase record does indeed exist using a calculation field on the Answer record.


        • 1. Re: pre-determining if relationship record exists

               If you have this relationship:


               TableA::matchField = TableB::matchfield

               Then, from a layout based on TableA, this expression is true only if there is at least one related record in Table B:

               Not IsEmpty ( tableB::matchfield )

               You can actually refer to any field in TableB that is not empty for any given record in that table. The matchfield is never empty so it makes a good choice for this expression.

               If matchfield is of type number, you can simplify that expression to:


               To get exactly the same results

          • 2. Re: pre-determining if relationship record exists

                 So far so good. Now to best figure how to determine whether or not an external file exists or not.  My current logic compares record count but in this case I don't have that ability so I was wondering if there is a better method to determine if an external file (ie.  aciadmin.an0) truly exists without attempting to import.


                    Exit Loop If [file exist is true]

                 End Loop

            • 3. Re: pre-determining if relationship record exists

                   What kind of "external file"?

                   A FileMaker File?

                   A File to be inserted in a container field?

                   A File from which you will import data?

              • 4. Re: pre-determining if relationship record exists

                     An xml file from which I will import data, which is essence is my response file from an external web service.

                • 5. Re: pre-determining if relationship record exists

                       Ah yes, something we discussed in another thread...

                       I wonder if FileMaker can "see" that file if it is in the process of being downloaded, but the download is not yet complete. That's not something that I can test easily on my system.

                       FileMaker can check the list of files in a folder if the enclosing folder is inside the documents folder. There are a number of plug ins that can list the contents of any folder on your computer and there are ways to use a system script to list the contents of a folder. The details of the last option depend on the OS that you are using.

                  • 6. Re: pre-determining if relationship record exists

                         I ended up changing my net framework program to build the file with a different extention, then rename it once it was completed so I don't attempt to import from an incomplete file, so I'm good for now.