3 Replies Latest reply on Apr 11, 2013 6:59 AM by philmodjunk

    script to filter a report

    HeidiStewart

      Title

      script to filter a report

      Post

           I created a report that i will run monthly to show those students whose Proposal is due within the next 30 days, but i need to filter out all those students whose proposal has already been completed.

           I have a calcuation field (c_MSc Proposal Due) which adds 6 or 8 months to the start date to get their proposal due date. 

           I have a date field (MSc Proposal Complete), when the student completes their proposal i put the date completed in.

           how do i write a script that i can attach to my Report layout that will automatically filter the records, as described above?

        • 1. Re: script to filter a report
          philmodjunk


               To start, take a look at this thread that lists a lot of scripted find examples: Scripted Find Examples

               You can use "<" & Get ( CurrentDate ) + 30 in the due date field. and "=" as the criteria in the Complete date field to find the records that you have specified as this will find all records where the completed date field is empty and the due date is within 30 days of today.

          • 2. Re: script to filter a report
            HeidiStewart

                 ok i tried what you said, but keep getting this error "This action cannot be performed because this field is not modifiable."

                 my script looks like this:

                 Set Field [Student Info::MSc Proposal Complete; "="]

                 Set Field [Student Info::c_MSc Proposal due; "<" & Get ( CurrentDate ) + 30]

                 Sort Records [Restore; No dialog]

                 in the link you gave i noticed it said i had to have a global field or it wouldn't work??  i dont understand that, but the only global field i have in my entire database is the Academic Year, and it has nothing to do with this report.

            • 3. Re: script to filter a report
              philmodjunk

                   You need to enter find mode first. If your script is in browse mode, this won't work and if the set field step refers to a calcuation field (and is not in find mode), you'll get the error that you describe.

                   Global fields are necessary for any fields used by the user to specify criteria for the search before performing the find. Since there are no user specified criteria in your case,  you don't need a global field.