9 Replies Latest reply on Aug 23, 2012 10:07 PM by philmodjunk

    Finding ALL Container File Sizes that are too big.

    blewvelvet

      Title

      Finding ALL Container File Sizes that are too big.

      Post

      Ok..so I'm trying to create a script that looks at each record's file containers and to keep only the records which may have one container that is larger than .6 MB in a found set.

      It first constrains a found set of records that first removes my administrative records.

      ---------------------------------------Ok..so I

      SHOW ALL RECORDS

      CONSTRAIN FOUND SET (removing the admin records) - works great up till "If" below:

      IF ((aPROJECTS::FILE SIZE Container Call Sheet D1 < .6)   &     
      (aPROJECTS::FILE SIZE Container Call Sheet D2 < .6) &
      (aPROJECTS::FILE SIZE Container Call Sheet D3 < .6) &
      (aPROJECTS::FILE SIZE Container Call Sheet D4 < .6) &
      (aPROJECTS::FILE SIZE Container Call Sheet D5 < .6) &
      (aPROJECTS::FILE SIZE Container Call Sheet D6 < .6) &
      (aPROJECTS::FILE SIZE Container Call Sheet D7 < .6) &
      (aPROJECTS::FILE SIZE Container Call Sheet D8 < .6) &
      (aPROJECTS::FILE SIZE Container Call Sheet D9 < .6) &
      (aPROJECTS::FILE SIZE Container Call Sheet D10 < .6) &
      (aPROJECTS::FILE SIZE Container Call Sheet D11 < .6) &
      (aPROJECTS::FILE SIZE Container Call Sheet D12 < .6))

      OMIT RECORD

      ELSE  Go to Record....[Next; Exit after last]

      End If

      ---------------------------------------

      - in other words...if all of these container fields is less than .6 MB then OMIT and go to the next one.

      I retyped this all so it may not be perfect...but is there anything funny here as to my addressing the file size in the "If" statement?
      Should I be using "&" or "and"?

      Each PDF container fields use a calculation of:  (Length(CONT CALLSHEET 1)/1024) / 1000   - to get to the .decimal number..the format is fixed number of decimals - 2

       

      Screen_Shot_2012-08-23_at_11.48.54_AM.png

        • 1. Re: Finding ALL Container File Sizes that are too big.
          philmodjunk

          First, you are using & where you should be using And.

          Second, you have 12 different fields in the same record for the same type of information. This strongly suggests defining a related table of records instead of using individual fields like this. The result is greater flexibility and much simpler scripting and calculations like this become much simpler as well.

          • 2. Re: Finding ALL Container File Sizes that are too big.
            blewvelvet

            Yes..I have to make 12 potential PDFs for one project. 

            Not sure how I can do an individual table for each container. Sounds messy. I have so many other scripts made around these PDFs that do other functions..including mail and printing.

            Is there some kind of container limit to a record?

            Changing to "and" didn't work.

            • 3. Re: Finding ALL Container File Sizes that are too big.
              philmodjunk

              It would be one table for all of these fields not an individual table for each container. It's actually much simpler overall, though like any major structure change to a database, you have to look before you leap and test your new design carefully before deployment.

              Don't know what you mean by a "container limit".

              Anytime I get a complex expression that isn't working, I break it down into simpler parts and test each part to see if the part works.

              Try this expression and see if it works:

              IF (aPROJECTS::FILE SIZE Container Call Sheet D1 < .6 ; "LessThan" ; "not less than: )

              In advanced you ca use the data viewer. In nonadvanced fileMaker, you can make this a calculation field or try this script version:

              If [ aPROJECTS::FILE SIZE Container Call Sheet D1 < .6 ]
                 Show Custom dialog [ "Less than" ]
              Else
                 Show Custom dialog [ "Less than" ]
              End IF

              If these tests do not work, take a look at your data and field types. Make sure that the field stores the data that you expect it to. Make sure that the field is either a number field or a calculation field that specifies number as a return type.

              One way to simplify the original expression would be to use this:

              Max ( aPROJECTS::FILE SIZE Container Call Sheet D1 ; aPROJECTS::FILE SIZE Container Call Sheet D2 ; aPROJECTS::FILE SIZE Container Call Sheet D3 ; //and so forth ) < 0.6

              Instead of a long chain of inequalities and And operators.

              And if these were 12 related records instead of 12 individual fields, the expression would be even simpler:

              Max ( RelatedTable::File Size Container Call Sheet ) < 0.6

              • 4. Re: Finding ALL Container File Sizes that are too big.
                blewvelvet

                You would think a simple IF / THEN would work based on a simple number being generated in a field.

                 

                I tried -  IF (aPROJECTS::FILE SIZE Container Call Sheet D1 < .6 ; "LessThan" ; "not less than: )

                But got a dialog saying

                "There are more “)” than there are “(” or there are more “(” than there are “)”."

                • 5. Re: Finding ALL Container File Sizes that are too big.
                  blewvelvet

                  I don't even think the fact that I have any container is the issue..it's really just twelve calculating fields that have result in a file size number. Its just a field with a number.

                  I just need to find the records that happen to have one file size that is greater than .6 in it's result.

                  Even if it was any other field calculating a number..this should be simple.

                  • 6. Re: Finding ALL Container File Sizes that are too big.
                    schamblee

                    You should be using the word "and". 

                     

                    Phil is stating there are easier and better ways to do things and creates less problems in the long run.

                    • 7. Re: Finding ALL Container File Sizes that are too big.
                      philmodjunk

                      IF (aPROJECTS::FILE SIZE Container Call Sheet D1 < .6 ; "LessThan" ; "not less than: )

                      Lacks a pair of quotes. It should read:

                      IF (aPROJECTS::FILE SIZE Container Call Sheet D1 < .6 ; "LessThan" ; "not less than" )

                      There was a typo in my original post of this.

                      • 8. Re: Finding ALL Container File Sizes that are too big.
                        blewvelvet

                        Still get's an error.

                         

                        • 9. Re: Finding ALL Container File Sizes that are too big.
                          philmodjunk

                          where's the If function?

                          IF (aPROJECTS::FILE SIZE Container Call Sheet D1 < .6 ; "LessThan" ; "not less than")

                          This is the syntax for a calculation field or an expression you can put in FileMaker Advanced's Data Veiwer not an If script step. There was a second example posted for using a script:

                          If [ aPROJECTS::FILE SIZE Container Call Sheet D1 < .6 ]
                             Show Custom dialog [ "Less than" ]
                          Else
                             Show Custom dialog [ "Less than" ]
                          End IF