我正在使用一个文本项目屏幕 ( type="5"
),其中包括整数数字输入 ( attributeType="2"
) 的答案。现在,当我使用用户输入值执行计算时,返回值始终是浮点数。
缩短示例:
<question key="#1" type="5" title="My Screen">
<answer key="#1_1" attributeType="2" nextQuestionKey="#2">
<text>Num1</text>
</answer>
<answer key="#1_2" attributeType="2" nextQuestionKey="#2">
<text>Num2</text>
</answer>
<text>Enter 2 numeric values</text>
<onLeaveOkPersistAssignment>
val1 = getAnswerValue($answer:'#1_1'); <!-- for example '1' -->
val2 = getAnswerValue($answer:'#1_2'); <!-- for example '2' -->
$local:result = val1 + val2;
</onLeaveOkPersistAssignment>
</question>
<question key="#2" type="0" title="My Screen">
<answer key="#2_1" nextQuestionKey="END">
<text>%PLC%</text>
</answer>
<text>The result is:</text>
<onEnterAssignment>
setPlaceholder('%PLC%', $local:result); <!-- the screen should display '3' not '3.0' -->
</onEnterAssignment>
</question>
是否有可能返回整数或至少将值转换为整数?