The dropdown from hell

72 views
Skip to first unread message

David Edwards

unread,
Feb 10, 2024, 7:22:56 PMFeb 10
to redcap open
Hello all,

Let's say I have a dropdown on my REDCap form called [dropdown], and it has the values:

1, 2.0
2, 6.0

... and further down the form I have a multiple choice field called [multichoice] with the options:

1, Option 1
2, Option 2
3, Option 3
4, Option 4

In the action tags for [multichoice], I've got the following:

@IF([dropdown:value]>='2','',@HIDECHOICE='4') @NOMISSING

(It's set as [dropdown:value]>='2' because more options will likely be added to [dropdown] in future)

I can't get it to work. I've tried a lot of permutations:

  • using the event or not
  • using single, double or no quotes
  • using [dropdown] or [dropdown:value]
  • adding in " and isnumber([dropdown])", "and isinteger([dropdown]"
  • removing all spaces
  • removing the @NOMISSING tag

But no matter what combination I try, I just can't get it to work.

So I'm just wondering if anyone has any ideas.

Thanks a lot,
David.

Luke Stevens

unread,
Feb 11, 2024, 5:36:17 PMFeb 11
to David Edwards, redcap open

Hello David,

 

I can’t see anything wrong with your syntax, but [multichoice] is on a different form (or survey page) to [dropdown], right? @IF is not dynamic within a page – it only has an effect when a page Is being generated.

 

From the docs:
>
Note: The conditional logic will be evaluated only when the survey page or data entry form initially loads; thus the action tag conditions will not be evaluated in real time as data is entered on the page.

 

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: Sunday, February 11, 2024 11:23 AM
To: redcap open <redca...@googlegroups.com>
Subject: [EXTERNAL]The dropdown from hell

 

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/GV2PR08MB8026A399D569B385C4A9D5A6BF492%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 11, 2024, 8:29:52 PMFeb 11
to Luke Stevens, redcap open
Ah I see. I wasn't aware of that Luke - sorry I was a bit slow on the uptake there.

Well, if we cant use that to show/hide choices on new versions of forms, then I guess the only alternative is to:

  • leave the [multichoice] field as is
  • make a copy of the [multichoice] field and add the new option to it - call this [multichoice_2]
  • use branching logic to show [multichoice] on old versions of the form and [multichoice_2] on new versions of the form.

(I forgot to reply to all so I've CC'd in REDCap Open on this reply)

Thanks a lot for your help,
David.


From: Luke Stevens <luke.s...@mcri.edu.au>
Sent: 12 February 2024 00:00
To: David Edwards <dw...@hotmail.com>
Subject: RE: [EXTERNAL]Re: [EXTERNAL]The dropdown from hell
 

All good David. You have you answer there then:

>
[multichoice] and [dropdown] are on the same form.

 

You therefore cannot use @IF to show/hide options in [multichoice] based on a specified default value for [dropdown].

 

Luke

 

From: David Edwards <dw...@hotmail.com>
Sent: Monday, February 12, 2024 10:17 AM
To: Luke Stevens <luke.s...@mcri.edu.au>
Subject: [EXTERNAL]Re: [EXTERNAL]The dropdown from hell

 

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

 

Thanks for replying Luke,

 

[multichoice] and [dropdown] are on the same form.

 

I put it in generic terms to try and make it clearer, but in reality [dropdown] represents "Form version" and [multichoice] represents a field which has had an option added to it in the latest form version.

 

The form version is defaulted to 1 for old forms and 2 for new forms. (and it could in future extend to 3, 4, 5, 6, ... as new form version are released)

So the intention here is to only show the new option on version 2 forms(or future 3, 4, 5, 6 ... forms), but hide it on the version 1 forms.

 

I hope that makes sense - I'm horribly aware of the room for confusion here.

Don't sweat it though Luke ... for now I'm just going to have to settle for the new option showing on old forms cos I've got to release it for a retest tomorrow, and I have a feeling it's OK in this particular case, but still, I'd really like to know how to get this @IF(@HIDECHOICE) combination working cos I know I'll need it sooner or later(e.g. if a choice is retired on a new form). So if anyone has any ideas, I'm all ears.


Thanks for taking the time to look at this.
David.

 


Amit Tandon

unread,
Feb 11, 2024, 11:13:56 PMFeb 11
to Redcap Open
You can try and split in two forms. The first forms shows the version number with other questions and when you switch to the next form, you have the values for @IF already present

David Edwards

unread,
Feb 12, 2024, 5:41:26 AMFeb 12
to Amit Tandon, redcap open
.... and again I forgot to CC in  REDCap open (arrgghhh!) ....


From: David Edwards <dw...@hotmail.com>
Sent: 12 February 2024 10:39
To: Amit Tandon <amit....@celworld.org>
Subject: Re: [EXTERNAL]Re: [EXTERNAL]The dropdown from hell
 
Hi Amit ,
Yes, I can see how that would solve the problem of the two fields being on the same form.
Thank you for your help,
David.


From: redca...@googlegroups.com <redca...@googlegroups.com> on behalf of Amit Tandon <amit....@celworld.org>
Sent: 12 February 2024 04:13
To: Redcap Open <redca...@googlegroups.com>
Subject: Re: [EXTERNAL]Re: [EXTERNAL]The dropdown from hell
 
Reply all
Reply to author
Forward
0 new messages