跳至主內容

搜尋

搜尋

Database + Vb To Match User To Picture

評論

7 條評論

  • Avatar
    Shotaro Ito

    Do you mean, enter user name and print his / her picture on a label?

    Use query prompt is an option.

     

    Consider you have database (excel file, access table etc )like this

     
    Name    Picure
    Potter    HP.JPG
    Weasley    RW.JPG
    Granger    HG.JPG
     

    And picture files (HP.JPG etc) in a folder.

     
    Create a label template, then create database connection to the text file (follow the video below)
     
    To create picture which use database field, place an external picture with database field
    and specify folder name and field name (Picture).
     
    In database setup > query, create a query with a prompt like:
    Field: Operator: Criteria:
    Name Contains QueryPrompt1
     
    To create query prompt, see video below:
     
    To select a record from search result,
    In Print dialog > Quantity > Queried Records, select [Selected At Print-time].
     
    With this, you can search a user from database and easily add users with pictures.
     
    *you can use text file (csv) as database, however criteria for query is limited - part match (begin with, Contain etc.) is not available for BarTender's native text database connection.
    0
  • Avatar
    Legacy Poster

    This is almost what I want! Thanks!

     

    The issue is that I can't allow the user to just query any user name... that would allow them to use somebody else's picture if they know their username.

     

    I need it so that a component pulls the username of whoever is logged in (VB script: Application.SystemUserName) and uses that to automatically query the database, without user input.

     
    Does that make sense?
    0
  • Avatar
    Shotaro Ito

    In that case - instead of having database + query prompt, get user name at the print time and show corresponding pic.

     

    From BarTender 10.1, you have "Print job field" data source.

    Create an external picture with data source,

    In data source > Print Job Field > User name returns full user name (display name).

    You can have  "John Smith.", then add another data source as ".JPG" etc.

     

    For BarTender 10.0 or before, you can use VB Script data source - in multi-line script,

    Value = Application.SystemUserName 
    

    Note that SystemUserName returns login name of the user(jsmith etc.), so it might be different from full name (display name).

     

    in Picture properties - Picture - Error handling, you can specify the behavior in case picture not found - such as show error or just print without a pic.

    0
  • Avatar
    Legacy Poster

    Would that still be using the database? I'm confused where the relation between username and image takes place.

    0
  • Avatar
    Shotaro Ito

    no, that doesn't use database. Instead, you must have picture files which has the same file name as user name (John Perry.jpg etc.)

    0
  • Avatar
    Legacy Poster

    Okay, this is beginning to make sense. My last question (hopefully): where would I have this picture saved?

    0
  • Avatar
    Legacy Poster

    Nevermind! Got it! Thank you for all the help.

    0

登入寫評論。