Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Hide Answer Row in Free Format CBC

I have a Free Format CBC using the classic_cbc table design.

I have 3 dependent variables (i.e. a respondent has to answer the CBC up to 3 times, once for each difference patient type - let's call them Patient 1, Patient 2 and Patient 3)

A previous answer tells me if they have Patient 1 and/or Patient 2 and/or Patient 3

I want to hide the row if they do not have Patient 1 (i.e. if Patient1=0, hide row 14) ; hide the row if they do not have Patient 2...etc.  

Any advice?
asked Nov 9, 2019 by anonymous
It's hard to say for sure without seeing your HTML, but you could wrap the relevant "<tr>" in the code with Sawtooth Script so that it only gets added to the table if certain criteria is met.  It would look something like this:

[% Begin Unverified Perl
my $html;
if (GETVALUE('Q1_1')) {
    $html .= '<tr>';
    $html .= '<td></td>';
    for (my $i = 1; $i <= 3; $i++) {
        $html .= '<td class="input_cell clickable">' . RADIOSELECT(QUESTIONNAME() . '_response', CBCDESIGNCONCEPTVALUE('cbc_Random1', $i)) . '</td>';
    $html .= '</tr>';
return $html;
End Unverified %]

But some changes are likely needed to make it work for you.  "Q1_1" can be replaced with a checkbox variable relating to whether this row should be shown or not.  The "3" can be updated with the number of concepts.  "cbc_Random1" and "response" have to be the names of the CBC task and free format variable, respectively.

Your solution to the original question

Please only use this to answer the original question. Otherwise please use comments.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

To avoid this verification in future, please log in or register.