14 Replies Latest reply on Jul 30, 2012 3:27 PM by philmodjunk

# How To Show Records From Seven Days Back

### Title

How To Show Records From Seven Days Back

### Post

Hi!

Our Electronic Medical Records is nearing launch, and I am in my final calculation and in need of help... So we have treatment records which capture treatment (MDS) minutes, and we need to report on two things, P1b(a) and P1b(b)

1.  P1b(A):  the number (#) of days the therapy was administered for 15 minutes or more in the 7-day period.
2.  P1b(B): the total number (#) of daily MDS minutes was provided in the 7-day period.

So primarily I need to

1) calculate from a Current Date, to count seven Days backward, and display these reports.

2) Given the above found set, COUNT the number of MDS minute fields that is greater than or equal to 15 minutes,

3) and the total calculation of MDS minutes in the seven day found set.

Number three is the eaiest step to accomplish, but I need to get the ball rolling by figuring out numbers 1 and 2....Will anyone be able to help me please? Thank You in Advance

• ###### 1. Re: How To Show Records From Seven Days Back

sorry, current date is not necessarily TODAY's date but any chosen report date that they need to calculate the P1b data from...thanks!

• ###### 2. Re: How To Show Records From Seven Days Back

1)

Define a date field with global storage: gSelectedDate so the user can select the report date.

a script can then be written:

Enter Find Mode []
Set Field [MDS::DateField ; MDS::gSelectedDate - 7 & "..." MDS::gSelectedDate ]
Set Error Capture [on]
Perform Find []

2) Define a calculation field that returns 1 if the minutes are 15 minutes or more in that record. Use a summary field to count or sum the values in this field.

3) A summary field can total the minutes over all the fields in the found set.

• ###### 3. Re: How To Show Records From Seven Days Back

Enter Find Mode []
Set Field [MDS::DateField ; MDS::gSelectedDate - 7 & "..." MDS::gSelectedDate ]
Set Error Capture [on]
Perform Find []

I tried this script (using my naming parameters) but im getting a syntax error... (See screenshot) when i input the g selecteddate..

plus, the Datefield isnt the auto create date, but a new set field for this calculation, am i correct? Thank You!!!

• ###### 4. Re: How To Show Records From Seven Days Back

heres the pic

• ###### 5. Re: How To Show Records From Seven Days Back

erroe

• ###### 6. Re: How To Show Records From Seven Days Back

It is the date field that auto enters the date. In find mode, set field enters search criteria into the specified field as though you were typing it into the field while in find mode.

When Setting up Set Field, there are two Specify buttons that must be clicked. To get Set Field [Table::Field ; Expression], add set field to your script and click the first button (specify target field). Select Table::Field from the list of fields. Do not click the specify button next to the repetition box. Click OK to close this dialog box. Now click the lower specify button (calculated result) and create the expression to the right of the semicolon (;). Do not try to type in the semicolon.

• ###### 7. Re: How To Show Records From Seven Days Back

Hello, I have tried everything and it still returns an error ..sn operator is expected here.. :(

• ###### 8. Re: How To Show Records From Seven Days Back

And what is highlightd when you get that error?

Can you copy what you have in your specify calculaiton dialog to the clipboard just before you click OK and get the error? Then you can paste that text here.

• ###### 9. Re: How To Show Records From Seven Days Back

DAILY COMPLETED RX::gSelectedDate - 7 & "…"DAILY COMPLETED RX::gSelectedDate

• ###### 10. Re: How To Show Records From Seven Days Back

Apologies for the typo in my original example. Use this expression:

DAILY COMPLETED RX::gSelectedDate - 7 & "…" & DAILY COMPLETED RX::gSelectedDate

• ###### 11. Re: How To Show Records From Seven Days Back

Thanks! That fixed the script--- but when I try to run it it only gives me a found set of 0 records... to further illustrate my db, it has an auto enter date creation field called aDATE which also functions as the main date field for each record. SHould this be factored in on the calcualtion above?

What could I be doing wrong? Thanks

• ###### 12. Re: How To Show Records From Seven Days Back

What happens if you remove Set Error Capture from the script and run it again? What message pops up to interrupt the script?

You can also select Modify Find and see exactly what search criteria was entered by the script.

• ###### 13. Re: How To Show Records From Seven Days Back

Hi

It says "No Records match this find criteria"

I tried it with usig the DateField and the aDate in the calculation

• ###### 14. Re: How To Show Records From Seven Days Back

That confirms that your script is actually entering find criteria or the message would be different.

I tried it with usig the DateField and the aDate in the calculation

I'm not sure what that means. In your table you have a date field. You want all records where the date in that field falls within the specified date range. Whatever field stores that date (and it must be a field of type date, not text) must be shown where I have blue text in the following script step:

Set Field [YourTable::YourDateField ; DAILY COMPLETED RX::gSelectedDate - 7 & "…" & DAILY COMPLETED RX::gSelectedDate ]

You may want to use the controls below Post A Answer to upload a screen shot of your script in the script editor.