Skip to main content

Search

Search

If A Value From An Xml File Is Less Than "x" Then Use Reverse Color.

Comments

9 comments

  • Avatar
    Shotaro Ito

    There's no conditional color / font setting change in BarTender (as of 2016R2) - you need VB Script in BarTender document's document options.

    Ex. From File > BarTender document options > VB Scripting > OnNewRecord

    ReferenceField("HR_QTY")
    ReferenceField("HR_TOTAL_QTY")
    
    if CINT(Field("HR_QTY"))<CINT(Field("HR_TOTAL_QTY")) Then
      Format.Objects("TXT_HR_QTY").TextColor = BtColor.White
      Format.Objects("TXT_HR_QTY").TextBackgroundColor = BtColor.Black
    Else
      Format.Objects("TXT_HR_QTY").TextColor = BtColor.Black
      Format.Objects("TXT_HR_QTY").TextBackgroundColor = BtColor.White
    End if
    

    see the sample attached.

     

    0
  • Avatar
    Shotaro Ito

    * Above(document option VB Script) requires BarTender Automation edition or above.

    0
  • Avatar
    Ian Cummings
    Moderator

    Or you can have two objects or layers giving the two print options, and then set the condition for when the object/layer is to print based on the value of the data source.

    0
  • Avatar
    Legacy Poster

    Your example appears to be pulling from two database fields in your CVS file.  Is it possible to only reference the xml qty fields to get the reverse color??

    0
  • Avatar
    Denis

    Hi,
    Is it possible to reverse color with barteder 9.01 or 10.1 with vbscript OnProcessData?
    I need reverse depends on value of database field

    I try:


    if CInt(Field("Reverse SN")) = 1 Then
    Format.Objects("TextSN").TextColor = BtColor.White
    Format.Objects("TextSN").TextBackgroundColor = BtColor.Black
    End if

    But OK button shows Warning message #5901
    "This script didnt read from the "Value" property, which means that the currently specified data source was completely ignored. This may not be what you intended"

    And on Lookup I get error with need object BtColor

    0
  • Avatar
    Shotaro Ito

    BarTender 9.01 didn't have color control.

    In BarTender 10.1 Automation Edition, you can modify object color by Document Option VB Script (not OnProcessData)

     From File > BarTender document options > VB Scripting

    As example above.

     

    0
  • Avatar
    Denis

    Thanks a lot!

    And how change color per Data Source. My Text Object consists of 3 Data Sources. In one of them I need to change color.

    0
  • Avatar
    Shotaro Ito

    Unfortunately change color/font per data source is not supported.

    You can try HTML text object, however in 10.1 text print quality is not very good. (HTML text print quality improved in BarTender 2016 R3)

    0
  • Avatar
    Denis

    Thanks for the information.

    0

Please sign in to leave a comment.