Repeating instances: out-of-sequence warning

27 views
Skip to first unread message

Jeff Theobald

unread,
May 9, 2024, 2:25:20 PMMay 9
to Redcap Open
Hi,
I want the instances of a repeating event to be entered in chronological order. I created a Data Quality Rule with real-time execution to alert the user of the out-of-sequence date- which worked, but I'd prefer to have a warning to be displayed in a Descriptive text field if the date entered on current instance is earlier than date entered on previous instance.
I tried the same approach described by Luke in this thread: https://groups.google.com/g/redcap_open/c/6bIvfwldgiU/m/AtgFyShGAAAJ

Branching Logic on the Descriptive field:
datediff([followup_arm_1][longdate][previous-instance],[followup_arm_1][longdate][current-instance],'d',true)< 0

But opening the form brings a pop-up error window:
CALCULATION ERRORS EXIST!
There is a syntactical error in a DATEDIFF calculation on this page.
PROBLEM: The first value ("02-15-2024") is not in the format specified in the equation (i.e. "ymd"). You will need to modify this field so that its validation format is now "ymd" or else modify the DATEFORMAT parameter in the equation.

PROBLEM: The second value ("03-23-2024")is not in the format specified in the equation (i.e. "ymd"). You will need to modify this field so that its validation format is now "ymd" or else modify the DATEFORMAT parameter in the equation.

The date field is in "mdy" (M-D-Y) validation format, and the field's format cannot be modified. The error message mentions the DATEFORMAT parameter, which I remember from a while ago, but that doesn't seem to be mentioned in our current documentation (v13.7.6). I found some old documentation that mentioned this parameter, but it failed when I tried using it. I also found some documentation elsewhere saying that datediff when used in branching logic can only be applied to dates in "ymd" format.

So I'm not sure if what I want is possible: use datediff in branching logic on a field that has M-D-Y validation.

Or, is there a way to convert a "mdy" date field to a separate "ymd" version within the same form? (I can use @CALCDATE to convert the date from the previous instance, but since action tags execute on page-load, it won't work for entering the date on the current instance.)

I can settle for the real-time executed DQ Rule, but it would be nice to have a warning immediately after entering, rather than on-save. It seems like I might be overlooking something that would get the branching logic approach to work -- any suggestions appreciated.

Jeff
(EDIT: after typing this I realized I can add a "Minimum" validation that refers to the date on previous-instance, so that is good -- but would like to have a more descriptive project-specific warning message.)




Luke Stevens

unread,
May 12, 2024, 8:16:04 AMMay 12
to Jeff Theobald, Redcap Open

Hello Jeff,

 

I think in branching logic it can still be helpful to include the date format as the fourth parameter of the datediff() function. I reckon the event ref and [current-instance] are redundant in a branching logic expression like that too, so try this:

 

datediff([longdate][previous-instance],[longdate],'d','mdy',true)< 0

 

HTH,

Luke

Luke Stevens
Research Data Systems Manager
Clinical Epidemiology & Biostatistics Unit (CEBU)
Murdoch Children's Research Institute
The Royal Children's Hospital, 50 Flemington Road
Parkville, Victoria 3052 Australia
T   +61 3 9345 6552
E   luke.s...@mcri.edu.au
W  mcri.edu.au

 

 

 

From: 'Jeff Theobald' via Redcap Open <redca...@googlegroups.com>
Sent: Friday, May 10, 2024 4:25 AM
To: Redcap Open <redca...@googlegroups.com>
Subject: [EXTERNAL][REDCap Open] Repeating instances: out-of-sequence warning

 

CAUTION:  External Email. Please be cautious with attachments and clicking links

 

--
You received this message because you are subscribed to the Google Groups "Redcap Open" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redcap_open...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/redcap_open/630b5a72-0c7e-45d3-bbba-03a0a8588627n%40googlegroups.com.



This e-mail and any attachments to it (the "Communication") are, unless otherwise stated, confidential, may contain copyright material and is for the use only of the intended recipient. If you receive the Communication in error, please notify the sender immediately by return e-mail, delete the Communication and the return e-mail, and do not read, copy, retransmit or otherwise deal with it. Any views expressed in the Communication are those of the individual sender only, unless expressly stated to be those of Murdoch Children’s Research Institute (MCRI) ABN 21 006 566 972 or any of its related entities. MCRI does not accept liability in connection with the integrity of or errors in the Communication, computer virus, data corruption, interference or delay arising from or in respect of the Communication.

Theobald, Jeff

unread,
May 12, 2024, 8:16:09 AMMay 12
to Luke Stevens, Redcap Open

Thank you, Luke – this works exactly as I had hoped! I could’ve sworn I tried that formulation, but I must have gotten it wrong.

 

Jeff

 

From: Luke Stevens <luke.s...@mcri.edu.au>
Sent: Thursday, May 9, 2024 6:54 PM
To: Theobald, Jeff <Jeffrey....@cchmc.org>; Redcap Open <redca...@googlegroups.com>
Subject: RE: [EXTERNAL][REDCap Open] Repeating instances: out-of-sequence warning

 

This email originated from an EXTERNAL sender to CCHMC. Proceed with caution when replying, opening attachments, or clicking links in this message.

Reply all
Reply to author
Forward
0 new messages