Have an idea?

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

AIC works in FreeFormat?

Does the AIC function work from the FreeFormat question type?

I have this code as the last cell (column) of a table within free format:

<td><div class="input_cell clickable">    [%CheckSelect(qname_picker, 1)%] </div></td>

On the next page I have another FreeFormat question and I want to show those items selected (i.e., using the "add if chosen" unverified perl script).

Does AIC really only work off of "preformatted" items (like select, rank, grid, etc)?
asked Dec 14, 2018 by WTW_cal Bronze (1,595 points)

1 Answer

0 votes
What differs free format questions from questions like selects is that free formats do not have any built-in list support.  When AIC points to a select question, Lighthouse knows to use the list used in the select question.  But if you try to point AIC to a free format question, Lighthouse doesn't know what to do because free formats don't have a defined list.

But there are ways to work around this.

First, let's create a predefined list with the item labels you want to show up in your free format question.  Once that's done, we can (optionally) replace the item labels in the free format to use the labels from the predefined list directly like this:

[% ListLabel(List1, 1) %]

Now we can create the constructed list, but we'll need some unverified Perl in place of AIC.  Try this:

Begin Unverified Perl
my $predefinedList = 'List1';
my $ffVariable = 'qname_picker';
for (my $i = 1; $i <= LISTLENGTH($predefinedList); $i++) {
    if (GETVALUE($ffVariable . '_' . $i)) {
        ADD($predefinedList, $i);
End Unverified

Of course, "List1" and "qname_picker" should be replaced in these scripts with the name of your predefined list and your free format variable, respectively.
answered Dec 15, 2018 by Zachary Platinum Sawtooth Software, Inc. (181,275 points)