Have an idea?

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

Skip based on time difference doesn't work

I have 2 hidden free format variables used to mark the start and end time of a CBC exercise and a third variable calculating the difference. I then try to use the value of the difference to terminate speeders. I can see the time stamps in the data and the calculated diff. The logic for the skip is setup correctly, but it doesn't work. It doesn't terminate speeders.  Any thoughts why this is not be working? I'm using V8.

Here are my variables:

Start time
<input name="leadercbctime1_beg" id="leadercbctime1_beg" type="hidden" value="

[%SystemTime()%]

">

End time

<input name="leadercbctime2_fin" id="leadercbctime2_fin" type="hidden" value="

[%SystemTime()%]

">

Difference estimation

<input name="timecbcleader_diff" type="hidden" value="
[%
Begin Unverified Perl  

VALUE("leadercbctime2_fin") - VALUE("leadercbctime1_beg")

End Unverified
%]
">


Skip Logic

timecbcleader_diff<"360"
asked Aug 25, 2012 by anonymous
Mike, I can see in the data that the difference was calculated and stored without the return statement. The value is there, but it is in the skip logic where something weird happens even if I don't get any errors when I click on the checkmark. Apparently it is correct, but the logic doesn't work. I have used it before without any problems in V7. In V8, it seems something changed about about how the value is recognized as numeric for comparison purposes. Did something change?

2 Answers

+2 votes
You need a return statement in the unverified Perl section otherwise the difference will be 0.

It should look like this
[% begin unverified perl

return VALUE("leadercbctime2_2") - VALUE("leadercbctime1_beg");
end unverified %]

Assuming those are freeformat hidden variables it should work.
answered Aug 28, 2012 by Mike Lodder Gold (23,410 points)
+1 vote
Assuming you have referred to your variable name correctly in the skip logic, the only thing I can see is the quotes around the 360 need to be removed. You are referring to a numeric value, not a text or string.

Try timecbcleader_diff<360 instead.
answered Aug 26, 2012 by Paul Moon Platinum (58,815 points)
...