Have an idea?

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

Customized CBC Questions Using "Free Format"


I created a customized CBC questions using free format.

I am attempting to use this code


to show the version and CBC task for the client but the version and task is not appearing in the free format question.

Please help.

Thank you in advance
asked Feb 20, 2020 by Sandy
Those functions can only be used in CBC tasks, but we can probably write some code that will achieve the same behavior in your free format tasks.  Fixed tasks will make things a bit trickier, if they exist - do you have fixed tasks in your exercise?
Hi Zach,

No fixed tasks

1 Answer

0 votes
You can use this script in place of calling CbcCurrentTask:

[% Begin Unverified Perl
my $qname = QUESTIONNAME();
$qname =~ /Random([0-9]+)$/;
return $1;
End Unverified %]

If your free format question is placed after the associated CBC task, you can use this script in place of calling CbcVersion:

[% Begin Unverified Perl
# Parameters
my $exercise = 'cbc';

# Run
my $qname = QUESTIONNAME();
$qname =~ /Random([0-9]+)$/;
return 'D - ' . GETVALUE('sys_CBCVersion_' . $exercise) . ', T - ' . $exercise . '_Random' . $1;
End Unverified %]

Line 3 will have to be updated with the name of your exercise.
answered Feb 21, 2020 by Zachary Platinum Sawtooth Software, Inc. (171,950 points)

My ff question is placed after the associated CBC task, and I have added the syntax for calling the CbcVersion but the version is null.  I get  1 D -, T- cbc_Random1.  I checked the data and the version is being written out
Is the name of your exercise "cbc"?
Yes, but cbc is all in caps.  When I changed cbc to all in caps, it worked.  Thank you so much!