Skip to main content

Search

Search

VB Script not calculating sum of fields

Comments

2 comments

  • Avatar
    Paweł Gancarz

    Hello David,

    I gave the objects to text, and the sum to numbers with two decimal places.
    Below you have pictures of what it looks like.

    One line script

    value=int(Format.Objects("A1").Value)+(Format.Objects("A2").Value)+(Format.Objects("A3").Value)+(Format.Objects("A4").Value)+(Format.Objects("A5").Value)+(Format.Objects("A6").Value)+(Format.Objects("A7").Value)+(Format.Objects("A8").Value)

    Add a condition to each object as it will be empty to insert zero

    As you wrote in your query

    IF Value="" then
    value="0"
    end if

    0
  • Avatar
    Peter Thane

    It should be if...then...else I believe and so you would need an

    else valueX = valueX 

    for every value 

    ie

    value1 = Format.Objects("Qty1").Value
    If value="" then
    value=0

    else value1 = value1

    endif

    0

Please sign in to leave a comment.