Switch between functions for label field

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
Spikenaylor
Enthusiast
Posts: 7
Joined: Mon May 05, 2014 11:14 am

Switch between functions for label field

Post by Spikenaylor » Wed Jan 08, 2020 3:27 pm

I want to use a common label with an Expiry Date field on it
Some of the labels only require an expiry date of a few days (Pulled from the source spreadsheet), other labels require an expiry on 1 month.


Variable - Process_day is Today

Function' ExpiryDateCalc' - Input Source - Process Day - Offset - Days - using Data Source ExpiryinDays(pulled in from Spreadsheet database source) - Adds the selected number of days onto the Process Day to get the expiry day.
ExpiryDateCalc Function.PNG
ExpiryDateCalc Function.PNG (13.72 KiB) Viewed 2388 times
Function 'ExpiryDateCalc-Month' - Input Source - Process Day - Offset - 1 Month - Adds 1 caqlendar month to the Process_Day to get the Expiry Date.
ExpiryDateCalc_Month.PNG
ExpiryDateCalc_Month.PNG (13.03 KiB) Viewed 2388 times
On the Label
I have a text field connected to Expires Data Source
with initial value set to [ExpiryDateCalc]

I have created a variable called MonthExpiry pulling in Yes from the Spreadsheet Source - Yes for when we require a Calendar Month to be added.

If MonthExpiry = Yes, then I want the Inital Value to be set to [ExpiryDateCalc_Month]

not managed to get this to work

tried in the initial Value field of the text box

If ([MonthExpiry] = "Yes", [ExpiryDateCalc_Month], [ExpiryDateCalc])
i get this error

Expires: Invalid Format dd/MM/yyyy for value If ( = "Yes", 08/02/2020, 08/01/2020)
ExpiryDate Error.PNG
ExpiryDate Error.PNG (22.58 KiB) Viewed 2388 times

Any pointers as to what i am doing wrong Or can I achieve this using two functions to enable using 1 common label

Many thanks for looking

highfrost
Valued Contributor
Posts: 34
Joined: Tue Aug 19, 2014 10:51 am

Re: Switch between functions for label field

Post by highfrost » Wed Jan 08, 2020 4:49 pm

i think I would use the 2 different time functions and save the result in separate variables; ExpDateMoths, ExpDateDays.
On the label I would put a different variable; ExpDateOnLabel.

If you want to show the label with the correct ExpDate as a preview on a form I would put a script in your load product sequence, something like

if expDatecalcMoth = yes then
ExpDateOnLabel = ExpDateMonths
else
expDateOnLabel = ExpDateDays
end if

If you just want in printed on the label and do not show a preview I would put the same script in the print sequence, just because I like such a change close to my print action :)

Post Reply