Using logical operators in the visibility options

Issues related to label design (working with databases, data processing, RFID encoding etc.) and printing (from NiceLabel Express, NiceLabel Pro, NiceForm and NicePrint)

Moderators: Georges, milos, NiceLabel Support Team

Post Reply
Ahok
Newcomer
Posts: 3
Joined: Wed Jul 29, 2020 10:54 am

Using logical operators in the visibility options

Post by Ahok » Wed Jul 29, 2020 11:02 am

Hello,

my label has a QR code I only want to be visible when the data source [ContainerContent]="10 l" OR "20 l".
I have no idea how to implement logical operators into the visibility options or if its even possible.
I read that VBScript might help here, but im not a programmer, so I dont know what to write in there. Can anyone help me here please?

User avatar
Kyleodonnell
NiceLabel Support
NiceLabel Support
Posts: 568
Joined: Mon Aug 28, 2017 3:07 pm

Re: Using logical operators in the visibility options

Post by Kyleodonnell » Wed Jul 29, 2020 3:18 pm

Ahok,

We have created a simple sample

That uses this script to set values
if [Barcode] = "10" then
Result = True
Else if [Barcode] = "20" then
Result = True
Else
Result = False
End IF
END if

The barcode uses the output of the function to set the visibility
Attachments
vbscript sample.nlbl
(3.62 KiB) Downloaded 4 times

Ahok
Newcomer
Posts: 3
Joined: Wed Jul 29, 2020 10:54 am

Re: Using logical operators in the visibility options

Post by Ahok » Thu Jul 30, 2020 11:06 am

Thats great, thank you. I got it to work in my label. I still have a few questions:

1. How can I get it to ignore letter case?

2. For every if needs to be a end if? Because I have like 50 more conditions for this script (50l, 60l, 70l etc). Does this mean i need to end the file with 50 end if?

3. Is it possible to store the script outside of the label file and just refer to it from within the label? There will be multiple labels using this script and it might change from time to time.

User avatar
Kyleodonnell
NiceLabel Support
NiceLabel Support
Posts: 568
Joined: Mon Aug 28, 2017 3:07 pm

Re: Using logical operators in the visibility options

Post by Kyleodonnell » Thu Jul 30, 2020 2:43 pm

Ahok,

1. Can you elaborate a bit more on the issue?
2. There are other ways to do the script, as it was a sample, there were only a few end ifs. We have services that can write a script for you to make your solution work.
3. As each label is unique, you would need to import the script into every label or create a solution file.

Ahok
Newcomer
Posts: 3
Joined: Wed Jul 29, 2020 10:54 am

Re: Using logical operators in the visibility options

Post by Ahok » Thu Jul 30, 2020 3:38 pm

1. Some people make errors when doing data entry instead of „10l“ they write „10L“.
3. Whats a solution file?

User avatar
Kyleodonnell
NiceLabel Support
NiceLabel Support
Posts: 568
Joined: Mon Aug 28, 2017 3:07 pm

Re: Using logical operators in the visibility options

Post by Kyleodonnell » Thu Jul 30, 2020 8:47 pm

Ahok,

as case is important when doing scripting, it may be possible and would require more advanced logic for scripting that our Professional Service Group could help with. A solution file is a combination of Forms and labels, https://www.nicelabel.com/learning-cent ... n-solution You could have a front end form that would drive printing and you would only have to create the the script once as it can be used on all of the labels inside the solution

Post Reply