3 Replies Latest reply on Jan 17, 2011 9:35 AM by philmodjunk

    (?) Conditional function help

    rmen

      Title

      (?) Conditional function help

      Post

      I wish to insert a calculation field ::Status into a patient assessment database that describes a patient as :"Active", "review if needed", "discharged" or "deceased".  The "active" option is chosen if our database user reviews the patient regularly (either daily or every other day).  The "review if needed" option is chosen if that patient is not seen regularly.  THe other options (in a drop down menu) include discharge and death.  These maybe selected when either event occurs manually.

      I would like the field to read "active" when a new record is made via an Assessment Layout for that patient but also read "review if needed" if that patient's layout is not visited for say, 3 days.

        • 1. Re: (?) Conditional function help
          philmodjunk

          You can use the Data option in Auto-Enter to enter "Active" in every new record.

          To update to "Review if needed" will require either a script or a calculation field that takes the place of your text field on your layout. You'd keep the text field for editing, but use the calculation field for display so that it can replace the contents of the text field with other text if conditions indicate that this should take place.

          1) Presumably you have a date field that records the date of last visit. A script that performed a find for all records where date of last visit is 3 days or more earlier in the past and status is active. It would then update the status field for each such found record to review as needed either in a loop that steps through these records or using Replace Field Contents.

          2) The calculation field approach might use this calculation:
          If ( txtStatus = "active" and DateOfLastVisit < ( get ( CurrentDate ) - 3) ; "Review if Needed" ; txtStatus )

          • 2. Re: (?) Conditional function help
            rmen

            THanks Phil

            I used the Scripted approach to find all records that have "Active" in ::Status.  To identify the sub set "not for review" I made a value in my Assessment table  " Not for daily review" that will have to be manually selected to help the script. I found the find using date of last assessment difficult.  I then tried to write the script as follows

            Find Records    Patient::Status: (Active) AND Assessments::LastChanges: (No Daily Review)

            Replace Field Contents (No dialog ; Patient::Status ; Patient::Status = " prn review")

            Running the script returns the records that satisfy the find criteria all right, but they now have the value "0" in the ::Status field.

            How can I resolve this?

            • 3. Re: (?) Conditional function help
              philmodjunk

              Patient::Status = " prn review" will evaluate to 0 or 1 (false or true) as it compares the current value of Patient::Status to " prn review".

              Just use " prn review" (why the leading space?"