Have an idea?

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

CBC - how to check what was selected for a task using perl

I have a CBC design. After each task I need to ask a subsequent question about the task selectioin and also should show the concept selected on the second screen.

I tried piping:
[% VALUE("TL10_Random1") %] directly
or getting the value of my first task in a variable:
[%
Begin Unverified Perl  
my $intVar = VALUE("TL10_Random1") ;

return $intVar;  

End Unverified
%]

but in both cases it was not successful - returns error as if SSi script is not correct or says: "The function call 'VALUE' contains an invalid number of arguments or an argument with an incorrect type."
My tasks are named: TL10_Random1 to TL10_Random11 indeed. I am also planning to use:
[%CBCDesignLevelText (TL10_Random1, 2, 1) %] once I find a way to define with Perl which concept was selected.

Can you please help me with a hint how to check the concept selected for a CBC task in perl or any other way?
Thank you in advance!
Milena
asked Nov 6, 2011 by anonymous

1 Answer

+2 votes
 
Best answer
My answer only works for "NON-SORTED" concepts! The code below shows the name of the selected item on a CBC task shown on previous pages.
[% Begin Unverified Perl
CBCDESIGNLEVELTEXT("TL10_Random1",CBCDESIGNCONCEPTVALUE("TL10_Random1",VALUE("TL10_Random1")),2);
End Unverified %]


The 2 at the end changes which level's text will be shown. I've had conditional display, so using 1 as the last parameter brought me the img source.

The "CBCDESIGNCONCEPTVALUE("TL10_Random1",VALUE("TL10_Random1"))" part, gets which concept was shown as an integer, 1,2,3,etc. Using this as a parameter to CBCDESIGNCONCEPTVALUE, one can obtain different levels as well, just concatenate them within your perl code.
answered Nov 10, 2011 by Bahadir Ozkurt Gold (16,930 points)
...