Print to text file with different file name

Hello,

I need to print each new order in a text file and each file should have a different file name.
By adding a new Printer with the printer type “Demo Printer (notepad)” it’s not working because all files have the same name.

Next step.
I created this Printer, template, and printer job:

Now, I created Action and in Rules under the Ticket Closing Rule I added the action:

Finally, I achieved printing new orders in a text file and each text file has a different file name.
This is how the files look like when I have new order (below picture left side):

The main problem here is when I just open a table and close it without adding any new items it also creating me a text file without items (below picture right side):

How can I avoid printing these text files when I don’t place any order?

Thank you for your support!

I’m not in front of one of my work terminals to give you exacts, but you could add a constraint - order counts greater than 1 so that it ignores any tables without orders.

Hello cpeckat,

I tried to put different conditions on contraint but it didn’t work.

In your rule add a custom constraint:

image

[=TN('{ORDER COUNT}')] > 0

the [=TN()] function converts the order count to a number so that one can perform greater than, less than, and equals properly.

Memo,

I tried to add a custom constraint in my rule but again when I open and close a table(without adding any new items on it) in which there are some items that are not settled yet it creates that file with just these three lines:

image

In case I open and close a table that is free(without any items on it) it does not create that file.

Is your states (Status) working correctly? When you add an item to a ticket it should have a status of “NEW”. After closing and reopening that status should change to “SUBMITTED”. Can you confirm this is what is happening?
ernwYv5eBa

When you created your “Print Fiskal File”, did you change the “Order State Name” and “Order State” after having in the rule? If so, remove it from the rule, save the rule, reopen the rule and add the action back in the place.

The Print Fiskal File should only fire when you have new orders, that’s what states fields are checking in the “Execute Print Job” action

If the above 2 items did not correct the situation, use this as a constraint:
{TICKET STATE:Status} Equals New Orders

2 Likes

In addition to what Bob_be suggests, I would also suggest moving the Print Fiskal File action into its own rule and instead of Ticket Closing use Before Ticket Closing. I find it best practice to isolate custom automation from the stock automation.

3 Likes

Beat me to it. haha I was about to suggest the same thing. To add to that: I would check the sort order of your rules as well.

1 Like

this one trips me up more than I would care to admint