Have an idea?

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

ACBC Choice Task Tournament


Kindly help me how to acheive this using perl script (or some other way) in Question text.

if (cond)
([%ACBCCurrentChoiceTask()%] of [%ACBCNumChoiceTasks(Notebooks)+1%])
([%ACBCCurrentChoiceTask()%] of [%ACBCNumChoiceTasks(Notebooks)+2%])

I tried using Perl script but didn't get succeeded.
asked Jul 26, 2014 by Abdul Bronze (2,630 points)
This is the code I tried...

[% Begin Unverified Perl

if (VALUE("S2_A") ge 24 && VALUE("S3")==2)
{return ([%ACBCCurrentChoiceTask()%] of [%ACBCNumChoiceTasks(Notebooks)+2%]);}
{return ([%ACBCCurrentChoiceTask()%] of [%ACBCNumChoiceTasks(Notebooks)+2%]);}
End Unverified%]

Kindly help me to get out of this.

1 Answer

0 votes
The first issue I see is that you're trying to mix SSI Script with unverified perl, which I don't think you can do.

The second issue (someone correct me if I'm mistaken/doing something dumb) is one I've run into before with some of these exercise specific functions, where they don't get evaluated at the same time as the rest of the Perl, which best I can tell causes the "+2" not to give the expected behavior. To get around this can do a hybrid SSI Script and JavaScript solution though.

([% ACBCCurrentChoiceTask() %] of <span id="numtasks"></span>)

<script type="text/javascript">
var numtasks = parseInt([% ACBCNumChoiceTasks() %]);
 if (parseInt([% Value(S2_A) %]) >= 24 && parseInt([% Value(S3) %]) == 2){
     $('#numtasks').html(numtasks + 1);
else {$('#numtasks').html(numtasks + 2);}

answered Jul 28, 2014 by anonymous