Capturing Point-in-Time Subreports in myEvolv
– Katie Hutchinson
Have you ever used a system, EHR, EMR, ERP, CRM, and started looking for data? You know it’s in there, you can’t make the system show you what you really want to know.
For example, sometimes it is nice to know, at any given time, what has happened in, say, the last 30, 60 or 90 days. Digital Face Sheets are great for that:
They give you a snapshot of current information as of today’s date.
But what if you want a point-in-time capture. What if you want to be able to look back and say, on this date, what happened the last 30 days before the event? You don’t want to open an old record and see up-to-date information. You want to see what was relevant then, not now.
Lucky, there is a fix for that.
What we need is a from and through date on the form to anchor to the subreport. The date of event can be the through date, but we have to create a from date. Here is an example in one system we work with:
On your form, create a new field with a Display Type Code of Date Only. Be sure after you are done testing your code to uncheck Is Visible.
Once you have your new field, you need a code on two fields:
-
New Field (Default Value code)
-
Actual Date (On Change Script code)
Use the same code on both fields. In your new field, put the following code in the Default Value field. If you auto populate the Actual Date field (todaysDateTime()), leave the Apply on Save box unchecked. If you have staff fill in the date when the form opens, click Apply on Save box.
You also need the code under Actual Date in the On Change Script. This will update the date filter if there are changes to the actual_date field. (If you don’t auto populate the actual_date field, you don’t really need them both places, but better safe than sorry.)
Now let’s talk about the code:
var actualDate is naming a new data point. This data point, called actualDate, will be created by pulling the date ONLY (new Date) from the field actual_date (getFormElement(‘actual_date’)).
The next var is naming date. This is saying make the data point “date” equal to actualDate (what we named the first line) MINUS 365 days. If we wanted it to be six months ago, we would put: addToDate(actualDate, 0, -6, 0, true);
The last line of the code tells the system to set the new field with this new date that created a “from” date for our subform. Here is the full code for a copy/paste (although you should always run it through NotePad to scrub any formatting):
var actualDate = new Date (getFormElement(‘actual_date’)); var date = addToDate(actualDate, 0, -6, 0, true); setFormElement(‘udf_date_for_filter’, date);
Now we go to the subform and anchor the actual_date with a Less Than or Equal to and the end_date with a Greater Than or Equal To:
Now you can see the last 6 months from the date of the event:
This is helpful for events like Discharge Forms, when clinicians want to show that outreach and re-engagement was attempted and that the client has not been in crisis in the last so many months. It is also helpful when listing assessments in the past year for a plan review or similar data you would want to capture as a moment in time.
Let us know what other tips/tricks you want to see!
Questions? Contact us via email: [email protected]