Filter Lines with Same Field Value

Label printing integration (NiceWatch middleware and ActiveX programming interface)

Moderators: Georges, milos, NiceLabel Support Team

Post Reply
luis.delgado
Newcomer
Posts: 1
Joined: Wed Jun 15, 2022 10:14 pm

Filter Lines with Same Field Value

Post by luis.delgado » Mon Jun 20, 2022 10:43 pm

Hi all,

Currently I have a profile that prints 1 label for each line sent from my WMS, each line representing 1 SKU. But I would like Nicelabel to only print 1 label per order.

So Nicelabel would have to recognize that any line with the same field value (i.e., ORDERID) is really a duplicate line and shouldn't be printed.
Is there a condition that I could use in the 'For each line' action or a script that I could run to achieve this?

Thanks!

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

Re: Filter Lines with Same Field Value

Post by Mytch » Mon Jun 20, 2022 11:48 pm

Luis,

I assume you are using NiceLabel Automation with a File Trigger for this? Your condition or script would need to be below "For Each Line" action, because this action definitely needs to complete no matter the circumstances. What needs to occur conditionally is the Open Label/Set Printer/Print Label actions (or similar). I recommend using a Group action like below if you will have multiple sub-actions:
2022-06-20_16h30_51.png
2022-06-20_16h30_51.png (20.96 KiB) Viewed 342 times
Now exactly how you do this depends a lot based on your exact data, circumstances, Automation product level, etc. It's easy to check a variable's last value to see if it matches or has changed, but if you have duplicate field values separated by more than 1 line apart it will be a bit trickier. For example, saving all processed values "somewhere" or in variable and checking if the current value is contained within the already processed list.

I think the easiest concept is like this:
- Automation processes and prints first label then saves current ORDERID to a variable or file
- Automation processes and checks if current ORDERID already exists in variable or file
- If not, continue with printing. If so, do nothing (or whatever you want)
- After all lines are processed, reset the variable or file to blank

Like I said, it's not possible to give exact recommendations without more information, but surely it is possible a few different ways.

Regards,
Mytch

Post Reply