Zum Hauptinhalt gehen

Suche

Suche

Adding two Data Entry Form Field Numbers

Kommentare

4 Kommentare

  • Avatar
    Peter Thane

    As you are adding you need to tell the VB that the values will be integers and so you need to add the CInt command to the two variables such as

    Value = 0

    Value1 = Cint(Format.NamedSubStrings("secondno").Value)

    Value2 = CInt(Format.NamedSubStrings("firstno").Value)

    Value = Value1+Value2

     

    0
  • Avatar
    Craig Leininger

    Update:

    I've tried simplifying my script - instead of Event Control, I'm using Single-Line Expression. The result is the same but lets me know it's the addition of the two values that is problematic - not the Script Type I'm using.

    I can display the value os GrossWeight: Format.NamedSubStrings("GrossWeight").Value

    I can display the value of TareWeight: Format.NamedSubStrings("TareWeight").Value

    I can even add a number to either one of these: Format.NamedSubStrings("GrossWeight").Value + 5

    But, I cannot add the two together. This results in a NULL result: Format.NamedSubStrings("GrossWeight").Value + Format.NamedSubStrings("TareWeight").Value

    0
  • Avatar
    Craig Leininger

    More findings:

    When I perform any other arithmetic on these variables other than addition, it works properly. Addition treats it as a string instead.

    GrossWeight = 10
    TareWeight = 5

    Format.NamedSubStrings("Gross-Weight").Value - Format.NamedSubStrings("TareWeight").Value
    RESULT: 5
    Format.NamedSubStrings("Gross-Weight").Value * Format.NamedSubStrings("TareWeight").Value
    RESULT: 50
    Format.NamedSubStrings("Gross-Weight").Value + Format.NamedSubStrings("TareWeight").Value
    RESULT: 105
    0
  • Avatar
    Peter Thane

    Did these cross with my CInt message above as that should work?

    You will need to use Event Controlled Scripts to add up the values that have been added on via a Data Entry Form. 

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.