3 Replies Latest reply on Nov 29, 2011 9:44 AM by philmodjunk

    Script issue help

    sly_1

      Title

      Script issue help

      Post

      I will try ny best to explain this.

       

      1. I have a services rendered report for multiple programs. (works awesome)

      2. I have a monthly report that i enter all services rendered in for counts and revenue. (works awsome)

      3. im tired of manually entering this in.

      so ive created a script to do the following.

      4. from monthly report, it will go to services rendered and it will do enter find mode, go to teh feilds and teh text i want. then copy paste to monthly report. (works awesome.

      5. if the find comes back as (no records match this set of find requests) i hit cancel it kills the script or i hit continue and it will enter the last set of numbers from the previous find.

      How can i have this just skip it all together if the find brings nothing back and have it move forward.

       

      hope this helps.

       

      Thanks

       

      sly

       

        • 1. Re: Script issue help
          philmodjunk

          4. from monthly report, it will go to services rendered and it will do enter find mode, go to teh feilds and teh text i want. then copy paste to monthly report. (works awesome.)

          Copy-Paste destroys any data the user may have copied previously to the clipboard and the referenced field must be present on the current layout or these script steps siliently fail. Using Set Variable and Set Field in place of copy and paste avoids these issues.

          How can i have this just skip it all together if the find brings nothing back and have it move forward

          In your script use Set error capture to disable the "no records found" dialog that FileMaker will otherwise pop up.

          Set Error capture [on]
          Perform Find
          If [ get ( FoundCount ) ]
             #Put the rest of your script here
          Else
             #Do what you need when no records are found
          End If

          • 2. Re: Script issue help
            sly_1

            i really dont understand how the ifs work.

            here is my script

            go to layout [services rendered]
            enter find mode
            go to feild [services rendered::month value]
            pause 5 seconds
            go to feild [services rendered::program]
            insert text [testing]
            pause 5 seconds
            perform find
            copy [select;services rendered::student count]
            go to layout [original]
            paste [select; month report::testing students]


            then it does this for the next 25 programs

             

            im not sure how i add all this into it

             

            Set Error capture [on]
            Perform Find
            If [ get ( FoundCount ) ]
               #Put the rest of your script here
            Else
               #Do what you need when no records are found
            End If

             

            thanks for the help

            sly

            • 3. Re: Script issue help
              philmodjunk

              What is the purpose for pausing for 5 seconds?

              Insert text, like all insert script steps fail silently if the field it interacts with is not present on the current layout.

              I'd use

              Set Field [services rendered::program ; "testing" ]

              instead, as it does not have this limitation.

              Copy and paste have the same limitation plus copy destroys any data the user may have previously copied to the clipboard--which both confuses and annoys them when this happens.

              I'd use:

              Set Variable [$StudentCount ; Value: services rendered::student count ]
              go to layout [original]
              Set Field [month report::testing students ; $StudentCount ]

              then it does this for the next 25 programs

              Why? That seems like a very cumbersome approach here. I suspect that with the correct tables, layouts and relationships, such a set of 25 different scripted finds is not needed and a much simpler method can be used to produce your monthly report.

              im not sure how i add all this into it

              Note the Perform Find step in your script that also appears in my script fragment. You put a set error capture just before each perform find to keep the "no records" dialog from interrupting your script. You then put the If block immediately after the perform find to control what happens if no records where found.

              You might modify the part of the script you posted as:

              pause 5 seconds
              Set Error capture [on]
              perform find
              If [ get ( FoundCount ) ]
                copy [select;services rendered::student count]
                go to layout [original]
                paste [select; month report::testing students]
              End If