MultiLabels PrintPreview from one SQL database

Label printing integration (NiceWatch middleware and ActiveX programming interface)

Moderators: Georges, milos, NiceLabel Support Team

Post Reply
Majki75
Newcomer
Posts: 2
Joined: Thu May 14, 2020 1:50 pm

MultiLabels PrintPreview from one SQL database

Post by Majki75 » Thu May 14, 2020 2:18 pm

Hi,
i created new Form, i joined it with SQL database. In database i am selecting products, which have lenght about 6 characters or 9 characters.
I put into Form new Window PRINTPREVIEW and i would like to select from 2 label templates - automatically connected on lenght name of product.
2 differential labels "Label1.nlbl" and "Label2.nlbl" i imported into card "SOLUTION" in NL2019.

Example:
- Name of product1 is "PROD_1" have 6 character, it means i expect in print preview "Label1.nlbl"
- Name of product2 is "PROD_2.01" have 9 characters, it means i expect in print preview "Label2.nlbl"
- Name of product3 is "PROD_2.11" have 9 characters, it means i expect in print preview "Label2.nlbl"
- Name of product4 is "PROD_3" have 6 character, it means i expect in print preview "Label1.nlbl"

I use VBS with command LEN ("string") for checking lenght of characters for "product", but i dont know, which command i have to use for VBS for open correct Label "Label1.nlbl" or "Label2.nlbl" - for execute VBS in window PRINTPREVIEW ?

User avatar
Mytch
NiceLabel Support
NiceLabel Support
Posts: 138
Joined: Fri Jul 13, 2018 10:26 pm
Location: Milwaukee, Wisconsin
Contact:

Re: MultiLabels PrintPreview from one SQL database

Post by Mytch » Thu May 14, 2020 3:45 pm

Majki75,

You'll need an If-Then statement to set a variable holding your desired label name. For example:

Code: Select all

If Len([database.field]) = 6 Then
[label] = "Label1"
Else If Len([database.field]) = 9 Then
[label] = "Label2"
Else
[label] = "check data"
End If
End If
In this case, the variable [label] will get set to the appropriate value. This can be used as the Data Source to your Preview object. Please let me know if you have any questions or concerns.

Mytch

Majki75
Newcomer
Posts: 2
Joined: Thu May 14, 2020 1:50 pm

Re: MultiLabels PrintPreview from one SQL database

Post by Majki75 » Fri May 15, 2020 11:00 am

Hi Mytch,
perfectly advice =D>
Thanks very much again.

Best regards
Marian

Post Reply