Database + Vb To Match User To Picture Follow

0
Avatar
Legacy Poster

I'm not sure if this can be solved with just a database or will need some VB as well.

 

I want something to search for a user's username in a database, and assign a picture as a result of a match. 

To add a new user, I don't want to have to update the VB script, I would rather just update the database. Any thoughts?

 

Many thanks,

Sean

7 comments

0
Avatar
Shotaro Ito
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

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

0
Avatar
Shotaro Ito
Comment actions Permalink

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
Comment actions Permalink

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

0
Avatar
Legacy Poster
Comment actions Permalink

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

Please sign in to leave a comment.