Count of returned options in a dynamic SQL dropdown?

30 views
Skip to first unread message

David Edwards

unread,
Feb 5, 2024, 11:34:20 AMFeb 5
to redcap open
Hello all,

Does anybody know a way to count the number of options returned by a dynamic SQL dropdown?

I need to detect if no options are returned so I can display a warning message (which in turn will disable the submit buttons with the @HIDESUBMIT action tag).

Thanks a lot,
David.

Luke Stevens

unread,
Feb 5, 2024, 4:32:21 PMFeb 5
to David Edwards, redcap open

The simplest way would be to have the message with @HIDESUBMIT say something along the lines of …

“Select an option from the dropdown list above. If no options are shown then you cannot proceed”

 

Fancier alternatives might be:

  • Use injected JavaScript to count the dropdown options and set a hidden checkbox you can branch the warning message off.
  • Handle it in the SQL – if there are none of the options you want get it to return an “error” option with a value that has your message displayed when it gets selected.

 

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: redca...@googlegroups.com <redca...@googlegroups.com> On Behalf Of David Edwards
Sent: Tuesday, February 6, 2024 3:34 AM
To: redcap open <redca...@googlegroups.com>
Subject: [EXTERNAL]Count of returned options in a dynamic SQL dropdown?

 

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/GV2PR08MB8026F4FCB4F98ACE66D548EDBF472%40GV2PR08MB8026.eurprd08.prod.outlook.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.

David Edwards

unread,
Feb 5, 2024, 4:44:07 PMFeb 5
to Luke Stevens, redcap open
Thanks for getting back to me on this Luke.
That's a very good idea. I'd completely forgotten about the Javascript Injector EM.
Thank you for your help,
David.


From: Luke Stevens <luke.s...@mcri.edu.au>
Sent: 05 February 2024 21:32
To: David Edwards <dw...@hotmail.com>; redcap open <redca...@googlegroups.com>
Subject: RE: [EXTERNAL]Count of returned options in a dynamic SQL dropdown?
 
Reply all
Reply to author
Forward
0 new messages