Issue with MultiLine Script Field Follow

0
Avatar
William Fisher

Hello, I'm working on a label that calculates a quantity to be displayed on the label based on the Quantity and Box Quantity; for example a Quantity of 50 with a Box Quantity of 30 creates two labels with one with 30 and the other with 20.

 

I have the code working but I'm running into an issue that on the initial print or print preview when it reaches a label it needs to calculate that value it starts only printing the first Quantity it calculates on every label that follows every so often. A second print or print preview will have it work correctly. Any one what might be the issue? Below is the script I'm using; the "Text 25" is a serialized value used to check which label in the count its on:

 

ReferenceField("DTP.SEG259")

ReferenceField("DTP.SEG249")

ReferenceField("DTP.SEG047")

IF CLng( Field("DTP.SEG259"))  > CLng(Field("DTP.SEG249")) THEN

                  IF (Abs( Format.Objects("Text 25").Value)) = (Round(Field("DTP.SEG259") / Field("DTP.SEG249"), 0)) THEN

                              IF (Field("DTP.SEG259") MOD Field("DTP.SEG249")) = 0 THEN

                                             Value = Replace(FormatNumber(Field("DTP.SEG249"), 0),",","")

                              ELSE

                                             Value = Replace(FormatNumber((Field("DTP.SEG259") MOD Field("DTP.SEG249")), 0),",","")

                              END IF

               ELSE

                                             Value = Replace(FormatNumber(Field("DTP.SEG249"), 0),",","")

               END IF

ELSE

               Value = Replace(FormatNumber((Field("DTP.SEG259")), 0),",","")

END IF

 

Please sign in to leave a comment.