Reputation: 1
I need to create pallet labels with an x of y serialization that uses an if then else statement to display either the standard carton per pallet value or a mod value from the database record set.
For my script object, I have a single line expression multiply the current pallet number by the record set's standard carton per pallet value to get a running carton total
Format.NamedSubStrings("PltSerial").Value*Field("Bartender Data Input.DataInput.CTN/PLT")
Then in the transform tab which Bartender displays as OnProcessData behavior, I have a code that states:
If the value of the running total carton object is greater than the record set's carton total value, display the record set's mod data of remaining cartons.
Else show the record set's standard carton per pallet value.
If Value > Field("Bartender Data Input Connection.DataInput.CTN-QTY") Then
Value = Field("Bartender Data Input Connection.DataInput.ModCTN")
Else
Value = Field("Bartender Data Input Connection.DataInput.CTN/PLT")
End If
This is working for the first record set.
However, once it gets to a new record, it's still taking the carton quantity criteria from the first record when choosing to display the mod or standard value.
My first record is a total of 16 cartons.
The first label displays the standard 10 cartons and the next the mod value of 6 because the object value of 20 is greater than the total of 16.
The next record is a total of 118 cartons.
The first label displays the standard 10 cartons, and then all labels after that display the mod value of 8.
Only the last label should display the mod value, because the object value is 120, which is greater than the total of 118.
However, it looks like the if statement continues to check if the object value is greater than 20, as it did in the first record set.
Is there a way to refresh when a new record is loaded or some other workaround?
Upvotes: 0
Views: 84