In order to actually make use of Form Memory, you'll need to refer to it in some manner, usually via the scripting in tablet rules, eForm Actions, eForm item visibility calculations, or formulas. Form Memory is most commonly used by Tablet Rules, for which the following variables are available:
- firstTime:
- This variable is true when there is no Form Memory of a prior form completion for the current patient (i.e. it's the first time they're completing a form).
- daysSinceLastCompleted:
- This variable will return the number of days since the form was last completed for the current patient.
- For example, you may want to show an Email Consent form every 6 months by using the rule: daysSinceLastCompleted > 180.
- If it's the first time the form is shown (i.e. no prior completions), the value is infinity.
- lastCompletedTag:
- This variable will use the string value stored by the "Remember Tag Expression" in the eForm Editor during the previous form's usage (used for storing of arbitrarily complex sets of values), as described below.
- For example, based on the example given in the Remember Tag Expression above, lastCompletedTag.split("|") would return a string array containing the previous form's values stored by Form Memory.
Tip: You may find it useful during your testing to add a formula item with caption "lastCompletedTag: $$" and formula "lastCompletedTag". This formula will allow you to see the value of the lastCompletedTag in your test eForm in real time.
Suppose you have a form: Form 1.
You want to be able to access a value entered in Form 1 during a previous tablet session. In this situation, you would need to set the various Form Memory fields, as follows:
In Form A, set the "Remember If Expression" to:
true
Copy RuleThen set the "Remember Tag Expression" to:
theItemRefToRemember.r
Copy RuleThen, use the following tablet rule to pull up this form again, based on this stored value:
lastCompletedTag == 'N'
Copy RuleSuppose you have 2 forms: Form A and Form B.
Retrieving Form Memory from the Same Tablet Session
Suppose you would like to create a tablet rule that shows Form B, based on a value entered in Form A during the same tablet session. In this situation, you could use the following tablet rule:
ScriptUtil.getResponse("theRefForFormA", "theItemRefOnFormA")
Copy RuleRetrieving Form Memory from a Previous Tablet Session
Suppose you would like Form B to be able to access a value entered in Form A during the previous tablet session.
Unfortunately, you can't use the above tablet rule to access values from previous sessions, but you can work around this limitation by storing Form A's value in the "Remember Tag Expression" for Form B.
In Form B, set the "Remember Tag Expression" to:
ScriptUtil.getResponse("theRefForFormA", "theItemRefOnFormA")
Copy RuleThis will store Form A's value in Form B's Form Memory during the first tablet session that Form A and B are completed. Then, during the second tablet session that Form B is completed, you can call upon this "Remember Tag Expression" in a tablet rule to access it from Form Memory:
For example, a tablet rule you could use to call upon this "Remember Tag Expression" value would be:
lastCompletedTag == 'N'
Copy Rule