@Calctext problem

21 views
Skip to first unread message

Ray

unread,
May 29, 2024, 5:54:10 PMMay 29
to Redcap Open

I have a multiple choice radio button field (presc_pg_ops ) with choices that look like this:

 

1, Choice 1

2, Choice 2

 

I have a text field with a @Calctext equation that looks like this:

@CALCTEXT(if([presc_smi_oats]='1','00084',

if([presc_qnl]='1', '0lay4',

if([presc_pg_ops]='1', [presc_pg_ops],

if([presc_pg_ops]='2', [presc_pg_ops],

if([presc_pg_bp]='1', 'PRG BP 1',

if([presc_pg_bp]='2', 'PRG bp 2',

if([presc_tsk_site_1]='1', 'TSK 1',

if([presc_tsk_site_1]='2', 'TSK 2',

'None')))))))))

 

Note the bold/italic portion above.

Basically I want the returned value for the two statements to be “Choice 1” and “Choice 2”

What I am getting is “1” and “2” NOT the labels.  I have tried adding “:value” to the field name but that just breaks the question. Plus the “raw” value should be the number anyway right?

The literature says “ Multiple choice fields can now have their raw value (as opposed to their choice label) piped by appending “:value” to the variable name – e.g., [my_radio_field:value]

But I DO WANT THE LABEL and not the raw value 1 or 2.

How can I get this to work? 

You can see I have manually entered values in the other if statementss but I am trying to avoid that by having the equation automatically return the LABEL  so as to avoid modifying the equation every time a new item is added.  In other words I could make the equation evaluate 10 choices but if there were only 2 available naturally the other 8 would be FALSE and not evaluated.

All help greatly appreciated.

Reply all
Reply to author
Forward
0 new messages