Formcalc嵌套if语句

时间:2015-11-12 20:13:56

标签: forms livecycle

我一直试图找出formcalc中的嵌套if语句,但出于某种原因我无法让它工作。

脚本在formcalc上,下面的第一个脚本可以工作,但问题是如果totalNum为零,则表单会因为除零而抛出错误。

    var Vprt = confirmedSources.voltot/totalNum * 100


if(Vprt > 15)then
    CANNOTSUBMITV.presence= "visible"
else
    CANNOTSUBMITV.presence= "hidden"
    cansubmitending.presence = "hidden"
endif

   $.rawValue = Vprt

我尝试了这个:

    If (totalNum  >0) then
         var Vprt = confirmedSources.voltot/totalNum * 100
    if(Vprt > 15) then
    CANNOTSUBMITV.presence= "visible"
else
    CANNOTSUBMITV.presence= "hidden"
    cansubmitending.presence = "hidden"
endif

   $.rawValue = Vprt

我也试过这个:

    If (totalNum>0) then
         var Vprt = confirmedSources.voltot/totalNum * 100
    if(Vprt > 15) then
            $.rawValue = Vprt
    CANNOTSUBMITV.presence= "visible"
else
    CANNOTSUBMITV.presence= "hidden"
    cansubmitending.presence = "hidden"
    else
         $.rawValue = null
endif

1 个答案:

答案 0 :(得分:0)

在formcalc中,每个if语句都需要一个endif语句,例如

If (totalNum  >0) then
    var Vprt = confirmedSources.voltot/totalNum * 100
    if(Vprt > 15) then
        CANNOTSUBMITV.presence= "visible"
    else
        CANNOTSUBMITV.presence= "hidden"
        cansubmitending.presence = "hidden"
    endif

    $.rawValue = Vprt
endif