4 Replies Latest reply on Sep 29, 2009 7:52 AM by djkhalif

    <cfset FORM.UnitsProd = FORM.EndUnits - (FORM.StartUnits) + 1 >

    djkhalif Level 1

      Good morning all,

       

      I am having a problem with this formula. <cfset FORM.UnitsProd = FORM.EndUnits - (FORM.StartUnits) + 1 >

       

      When FORM.StartUnits = 1 then, my calculations are wrong. For instance, EndUnits and StartUnits represent serial numbers, which I can then, total as UnitsProd. If EndUnits = 3 and StartUnits = 1; I get 3 = 3-1+1. But, 15 = 60 - 46 +1. Would a cfif statement resolve this?

       

      <cfset FORM.UnitsProd = FORM.EndUnits - (FORM.StartUnits) + 1 >

      <cfif>

      #FORM.StartUnits# = 1

      <cfelse>

      <cfset FORM.UnitsProd = FORM.EndUnits + FORM.StartUnits >

      </cfif>

       

      Does this make sense?

       

      Thanks in advance,

       

      DJ Khalif