Zum Hauptinhalt gehen

Suche

Suche

Conditional Printing Of Some Fields

Kommentare

3 Kommentare

  • Avatar
    Ian Cummings
    Moderator

    This older version of BarTender doesn't support dynamic object modification.  However, you can get the result you want by stacking the two barcode types as two objects, on on top of the other.  You would then use a an OnProcessData VB script to make a conditional statement.  Set the data source of the object to nothing in order for it not to print.  Therefore based on the condition, set the data for one barcode with the data you want, and the other with an empty data source value.  An object with an empty data source will not print.

     

    Here is a white paper that covers dynamic object modification in later versions:

     

    http://www.bartenderbarcodesoftware.com/label-software/whitepapers/Dynamically-Changing-Objects-At-Print-Time-Using-VB-Script.pdf

    0
  • Avatar
    Legacy Poster

    Hi Ian,

     

    Based on the whitepaper, there should be a GHS_demo.btw in the Formats folder of Bartender, but I can't find it on mine.

    By any chance, can you send me the GHS_demo.btw so that I could understand how it works.

    TIA.

     

    Also, I tried your suggestion on setting the data source to Nothing, but I'm encountering an error, here's my sample code:

    I put this on the OnProcessData Event of Field6:

     

    val1 = Format.Objects("Field1").Value

    val2 = Format.Objects("Field2").Value

    val3 = Format.Objects("Field3").Value

    val4 = Format.Objects("Field4").Value

    val5 = Format.Objects("Field5").Value


    If (val2= "50") Then

    Value = val1 + "$$V" + val2 + "$" + val3 + "$"+ val4 + "$" + val5

    Else

    Set Field6 = Nothing

    End If

    0
  • Avatar
    Ian Cummings
    Moderator

    The GHS example requires v9.30 or later, you won't be able to see how it works because much of the functionality is in a feature that's not supported in your version.

     

    The "value = x" expression is what sets the value of the current data source.  Note that you will be setting a string value.  Therefore your If...Then statement should look like this:

     

    If val2 = "50" Then
      value = val1 & "$$V" & val2 & "$" & val3 & "$" & val4 & "$" & val5
    Else
      value = ""
    End If
    
    0

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