conditional piping

1,498 views
Skip to first unread message

Luciana R C Barros

unread,
Jul 5, 2021, 12:05:25 PM7/5/21
to redcap open
Hi guys,

I have a form that is only one field with a text and several autocomplete based on piping. Can I use an "if" for piping to appear or not? I tried the example below, but it does not work.

For example: if([medicine_n]>1, [medicine1][medicine_2],[medicine_1])

Thanks,

--
Luciana R C Barros

Centro de Investigação Translacional em Oncologia
Instituto do Câncer do Estado de São Paulo
Faculdade de Medicina da Universidade de São Paulo
Av. Dr. Arnaldo, 251.  Cerqueira César
CEP 01246-000 - São Paulo - SP - Brasil
Tel: + 55 11 38933014


Simon Vanderschaeghe

unread,
Jul 5, 2021, 1:01:56 PM7/5/21
to redcap open, Luciana R C Barros
Hi,

Conditional piping is not possible, but as a workaround you could use an intermediate field that uses @CALCTEXT and the equation you already have.

Kind regards,
Simon

From: redca...@googlegroups.com <redca...@googlegroups.com> on behalf of Luciana R C Barros <lucia...@gmail.com>
Sent: Monday, July 5, 2021 6:05:13 PM
To: redcap open <redca...@googlegroups.com>
Subject: conditional piping
 
--
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/CAO_h17wGUNVUOQmzZvwAGBH_GgNHBUpWj4uAV-42rgZ7WhKndw%40mail.gmail.com.

Peter Macisaac (POP)

unread,
Jul 6, 2021, 3:30:01 AM7/6/21
to Luciana R C Barros, redcap open
In general REDCap if statements can only produce a numeric output as results of the condition, but can certainly be nested.

If I understand your requirement you collect data on medicines and have a field that contains the number of medicines

You wish to show these medicines in another field by piping but don’t want to see the underscore r output REDCap gives if piping a blank field.

Have you consisted the field concatenation capability

One way to do this is to use @DEFAULT.  

There is also an external module for concatenation which is excellent (if you don’t know what an EXTERNAL MODULE is the contact your admin or look up previous discussions in REDCAP OPEN)

I have produced a small sandpit project to give you an idea how @DEFAULT works

Add this to your project in the data dictionary and upload

sandpit.csv

Peter Macisaac (POP)

unread,
Jul 6, 2021, 3:49:37 AM7/6/21
to Simon Vanderschaeghe, redcap open, Luciana R C Barros
Simon,

Thanks for bring the calctext feature to my attention


When did this come in, I cant make it work with my institutions version of REDCap


Peter



Luciana R C Barros

unread,
Jul 6, 2021, 7:44:58 AM7/6/21
to Peter Macisaac (POP), Simon Vanderschaeghe, redcap open
Thanks a lot for the answers!

Actually, I don`t think it works well because I have embedded fields on this form. This field is a "descriptive text" with a written report where I fill all the gaps with drug information that causes adverse effects. So, I have one or several drugs causing reactions, which are described in structured fields in previous forms. I just fill this text with drug information using piping and they export to a pdf and send it to the regulatory agency. When I have only one drug, there is a lot of ____ for blank values of other drugs. First, I repeat the form and use branching to choose one, two, or more drugs. But as this field has embedded fields, it shows a message and doesn`t work.

I tried the sandpit solution with concatenated text "concat([medicine_1],[medcie_2]), but it doesn't work. It appear the as "concat(Medicine, Medicine)". My REDCap is version 10.5. I work around and change the organization, so it looks better. If the blank fields do not appear as ___ it would be better.

Nevertheless, I used @CALCTEX in other fields, which help me a lot!

Thanks again,

Luciana


Reply all
Reply to author
Forward
0 new messages