Better way to handle initial blank variable value for data initialization?

Label printing integration (NiceWatch middleware and ActiveX programming interface)

Moderator: NiceLabel Support Team

Post Reply
dan2
Newcomer
Posts: 3
Joined: Sat Aug 03, 2019 4:30 am

Better way to handle initial blank variable value for data initialization?

Post by dan2 » Fri Aug 09, 2019 7:40 am

I have a solution file (Nicelabel 19.1) that allows users to open an assortment of different external label files, all of which require a single OrderId variable in order to print. The labels use this variable as part of a SQL lookup to determine what to print on the label and how many to print.

I am currently using the Data Initialization function as the means for having the users pass the OrderId to selected label file. I would like to have a Label Preview object be visible to the users of what the select label looks like before printing without any extra clicks. The problem I'm having is that as soon a label is selected the preview displays the below error before the user even has a chance at entering an OrderId:

Image

Since Actions cannot be applied to Data Initialization there is no way that I've been able to work out that would make it possible to have the preview wait until an attempt was made by the user to enter in a variable. Is there another way I can accomplish this?

It would be nice if the functionality of the Label Preview was more like just opening up a label file to edit where the unknown, not-yet-set variables are simply shown as "?????" so you can still see the label's basic structure/sizing. If the user tries to print with an invalid variable (or none at all) THEN this error would display as a standard error message dialog.

Alternatively, if there was another to accomplish passing the OrderId to label other than this current setup, I would be open to trying that as well.


Thank you.

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

Re: Better way to handle initial blank variable value for data initialization?

Post by Kyleodonnell » Fri Aug 09, 2019 2:14 pm

Dan,

The support team has already replied to your SRX ticket in support.

shawnWork
Valued Contributor
Posts: 23
Joined: Tue Sep 20, 2022 11:04 pm
Location: Indianapolis

Re: Better way to handle initial blank variable value for data initialization?

Post by shawnWork » Thu Oct 27, 2022 2:00 pm

...Would the support team care to share that knowledge since this is a forum? Please??

Stewered
Newcomer
Posts: 2
Joined: Mon Jan 30, 2023 6:42 am

Re: Better way to handle initial blank variable value for data initialization?

Post by Stewered » Mon Jan 30, 2023 6:44 am

Static Initialization: Here, the variable is assigned a value in advance. This variable then acts as a constant.
Dynamic Initialization: Here, the variable is assigned a value at the run time. The value of this variable can be altered every time the program is being run.
regards: hp sprocket

Stewered
Newcomer
Posts: 2
Joined: Mon Jan 30, 2023 6:42 am

Re: Better way to handle initial blank variable value for data initialization?

Post by Stewered » Mon Jan 30, 2023 6:45 am

An uninitialized variable is a variable that has not been given a value by the program hp sprocket (generally through initialization or assignment). Using the value stored in an uninitialized variable will result in undefined behavior.

Post Reply