6 Replies Latest reply on Nov 11, 2014 11:03 AM by Stilts15ak

    Inserting an Omit Recrods In a pre-generated script.

    Stilts15ak

      Title

      Inserting an Omit Recrods In a pre-generated script.

      Post

      I'm working on a lighting database for a theatre show. I would like to omit records automatically that have a certain field that is blank for a report. Script below that I have tried.

      --Enter Browse Mode[]

      --Go to Layout ["channel Hookup" (Rocky Horror)]

      --Sort Records [Restore; No dialog]

      --#Go to Preview mode for earlier versions which do not support summary reports in Browse mode.

      --If [GetAsNumber (Substitute ( Get ( ApplicationVersion ); "."; "x" ) ) < 1000]

            --Enter Preview Mode [Pause]

            --Enter Browse Mode []

            --Go to Layout [original layout]

      BELOW IS MY ADDITION, ABOVE IS FILEMAKER GENERATED WHEN REPORT WAS FIRST CREATED.

      --Else if [IsEmpty ( Rocky Horror::Dimmer )]

            --New Record/Request

            --Set Field [Rocky Horror::Dimmer["*"]]

            --Omit Record

            --Perform Find []

      --End If

       

      I've done a bunch of searching, but I'm at a loss. Looking for what ever help anyone can give. Not used to Filemaker's scripting language. And sort of a newbie with Filemaker Pro.

      Thank You!

       

        • 1. Re: Inserting an Omit Recrods In a pre-generated script.
          philmodjunk

          You need to understand the difference between layout, browse and find mode. Your New record, set field, omit record steps are being performed in Browse mode so these steps are creating and hiding a new record instead of generating an "omit" find request unless you left out a script step in your post here.

          And your set field step is not set up correctly either.

          Enter Find Mode [] ---> clear the pause check box
          New Record/Request
          Set Field [Rocky Horror::Dimmer ; "*" ]
          Omit Record
          Perform Find []

          This will produce a found set of all records except those where the field Rocky Horror::Dimmer has data in it. The resulting found set will not be sorted so if this is a summary report with sub summary layout parts, you also need a sort records script step.

          When Setting up Set Field, there are two Specify buttons that must be clicked. To get Set Field [Table::Field ; Expression], add set field to your script and click the first button (specify target field). Select Table::Field from the list of fields. Do not click the specify button next to the repetition box. Click OK to close this dialog box. Now click the lower specify button (calculated result) and create the expression to the right of the semicolon (;). Do not try to type in the semicolon.

          Caulkins Consulting, Home of Adventures In FileMaking

          • 2. Re: Inserting an Omit Recrods In a pre-generated script.
            Stilts15ak

            Thanks for the reply back.

            This seemed to work once. But only returned back the files that I wanted to omit.

            And yes it is a sub summary.

            • 3. Re: Inserting an Omit Recrods In a pre-generated script.
              philmodjunk

              Please describe what you mean by:

              This seemed to work once. But only returned back the files that I wanted to omit.

              I assume that you mean "records" not "files" here.

              Note that this omit will only take place if the current record in your found set has an empty "Dimmer" field. If the current record has data in this field, this part of your script does not execute.

              • 4. Re: Inserting an Omit Recrods In a pre-generated script.
                Stilts15ak

                Yes, "records", of course. Thank you.

                Yes. Understood. But just to clarify that we both are on the same page. I would like to omit records where this field has no data in it. It seems the only way right now is do it with a manual find and omit and then resort. Hoping to automate this with a script. Preferably adding on to the script that FMP generated when the report was made.

                The report is set to sort from one field (Channel) and then by two others (Postition & Unit #). See Image attached.

                • 5. Re: Inserting an Omit Recrods In a pre-generated script.
                  philmodjunk

                  But your script, as written, doesn't actually do that every time that it is performed. It happens only if the value of this field for the current record is empty.

                  If you want this omit to take place all the time, it should not be enclosed in the "Else IF" block.

                  • 6. Re: Inserting an Omit Recrods In a pre-generated script.
                    Stilts15ak

                    Ah Ha! Gotcha!

                    Yes. Taking that out of the Else if block works and adding a sort command at the end makes this work.

                    Thank you so much for your suggestions and time!