7 Replies Latest reply on Dec 17, 2010 9:10 AM by philmodjunk

    Scripts ... What does this do?

    alex4478

      Title

      Scripts ... What does this do?

      Post

      Hi,

      I have this script that is supposed to find patients that are new, i.e. finding patients that have had thier first visit in the last month. But using this script gives me results for the report that does not make sense. Could some one explain the script and maybe where I can put it right.

      Thanks

      what_script.jpg

        • 1. Re: Scripts ... What does this do?
          hbrendel

          Probably the find is not performed in the right context. Move the step Go to Layout ["NewPtReport" (PatientData)] to the top of the script and try again.

          • 2. Re: Scripts ... What does this do?
            raybaudi

            Hi

            Set Field [ PatientData::FirstVisit ; Date ( Month ( Get ( CurrentDate ) ) ; 1 ; Year ( Get ( CurrentDate ) ) ) & "..." & Get ( CurrentDate ) ]

            will find all the patients, which had the first visit in the current month.

            Set Field [ PatientData::FirstVisit ; Date ( Month ( Get ( CurrentDate ) ) - 1 ; 1 ; Year ( Get ( CurrentDate ) ) ) & "..." & Date ( Month ( Get ( CurrentDate ) ) ; 0 ; Year ( Get ( CurrentDate ) ) ) ]

            will find all the patients, which had the first visit in the last month.

            • 3. Re: Scripts ... What does this do?
              alex4478

              raybaudi

              Thanks for the reply but, i get an error message about invalid get function on the CurrentMonth.

              Any ideas?

              • 4. Re: Scripts ... What does this do?
                raybaudi

                That was an error that I sudden corrected...

                • 5. Re: Scripts ... What does this do?
                  alex4478

                  Hi,

                  Sorry but how do I paste your text into FM?

                  • 6. Re: Scripts ... What does this do?
                    ninja

                    Howdy all,

                    No intent to confuse things here, but you might want to consider finding all patients within the last 30days, rather than by what month they visited...you don't know what day of the month the script will run.  This, of course, assumes that you WANT to find new patients within the last 30 days...you know your needs best, not me.

                    If this is what you want, consider changing your SetField step to:

                    Set Field [ PatientData::FirstVisit ; Get(CurrentDate)-30 & "..." & Get(CurrentDate) )

                    Again, this would ignore month starts and stops and simply give you patients over the last 30 days.

                    Just another option...

                    • 7. Re: Scripts ... What does this do?
                      philmodjunk

                      You can't paste an entire script copied as text from here or elsewhere into the script editor. That'd be nice, but can't do it with just FileMaker.

                      You can paste bits and pieces of it such as the second parameter of Raybaudi's set Field steps into a Specify Calculation dialog. Just be careful to make sure the pasted text matches the actual table and field names defined in your database or you'll get error messages.