Trust ID PBCEX logo 300x102

How do I setup automatic printing?

11 years 7 months ago
Rutger Koperdraad
Platinum Boarder
Platinum Boarder
Posts: 1566
More
Topic Author
How do I setup automatic printing? #35
Question: How do I setup automatic printing?

Answer: Setting up automatic printing in CardExchange is done in four steps:

1. Create a storage item
To use automatic printing, CardExchange needs a condition that specifies whether a database record should be printed or not. Such a condition is called a trigger and could for example state that the print-date field should contain a null value or that the print-counter field should be equal to zero. To avoid that a card is printed twice, it is essential that the condition is not fulfilled anymore after printing the card. For that reason, triggers are always based on a storage item and you first need to define a storage item that is suitable for defining a trigger condition.

2. Create a trigger
To define a trigger, select the card you want to define a trigger for and click Edit trigger in the Automated printing menu. In version 4, the Edit trigger button is found in the Configuration tab. In this window, you can activate the trigger for the selected card layout, specify the associated storage item (for example, a storage item that stores the print date) and set the trigger condition (the value that the database field should have for the card to be printed; the default setting is IS NULL). You can also specify how often CardExchange should check whether a card needs to be printed. The default setting is each 10 seconds, which is generally fine. If you check more often, it will cause more traffic on the database. If you check less often, there might be a bigger delay between the condition being fulfilled and the card being printed.

3. Add additional conditions (optional)
The ordinary filters do not apply to automated printing, so if there are any additional conditions to be fulfilled by a specific card layout, you need to define them here. Imagine that for a card layout, you not only require that the print date be a null value, but you also want the field Department to contain the value 'Sales'. in that case you enter as trigger condition:

IS NULL AND Department = 'Sales'

You can add as may conditions as you want. They are formatted as native SQL of the connected database, so the exact form of the conditions might vary according to the database you use.

4. Start automatic printing
If you have defined triggers for all card layouts that need to support automated printing, you are ready to start printing. This is done by clicking Start automated printing in the Automated printing menu (the Configuration tab in version 4). The print log will show at the bottom of the CardExchange interface and any pending print commands are sent to the printer. Take care when starting automated printing for the first time, because many print commands might be pending. First use a small database for testing.

Remarks:
1. When automated printing is activated, you cannot print cards manually. If you need to print a card manually, you first have to stop the print server by clicking the Stop button in the print log.
2. Cards that cannot be printed due to an error, will not be printed again automatically. CardExchange keeps track of the database IDs printed for a certain card and will not print the same ID twice. When you stop automated printing and start it again, the database IDs already printed will be removed from the memory and cards that could not be printed previously due to some error will print again.
3. Print jobs that are sent succesfully to the print spooler, will be marked as printed in CardExchange and the storage item will be updated. If printing fails afterwards for some reason, it will not be printed again automatically. You need to define some procedure for reprinting cards that are not printed correctly.

Rutger Koperdraad
Senior Software Engineer

"A reasonable man adapts himself to the world. The unreasonable man persists in trying to adapt the world to himself. All progress, therefore, depends on the unreasonable man." (Bernard Shaw)
11 years 1 month ago
Craig Bechelli
Administrator
Administrator
Posts: 624
More
How do I setup automatic printing? #432
Is it possible to set up the automated printing to work with just "0" and "1" values ?
So if the field is "0" the record is printed and the field updated with a "1".

I can see options to write back environment variables and date time stamps, but not to define a fixed value to write back.

Also could you provide an example of the trigger condition for "is equal to 0" ?
The following work ok but I could not get a number to work as a trigger condition:
IS NULL / IS NOT NULL / = "TEST"

I am connecting to an Excel spreadsheet.

Many thanks,

Craig Bechelli
CardExchange Solutions Support Team

"If you define the problem correctly, you almost have the solution." (Steve Jobs)
11 years 1 month ago
Rutger Koperdraad
Platinum Boarder
Platinum Boarder
Posts: 1566
More
Topic Author
How do I setup automatic printing? #436
Hi Craig,

To update a field from 0 to 1, you can define the storage item for that field as a counter. You can also map the storage item as a manual entry and type 1 in the manual entry window, or define a system environment variable with value 1 and map the storage item to this environment variable.

The trigger condition for an empty field is not always clear. Sometimes you need "IS NULL", sometimes "= 0". You have to try that out. In any case, I would not recommend to use Excel for this, as it cannot be considered a proper database for this type of advanced applications. MS Access is preferable.

Rutger Koperdraad
Senior Software Engineer

"A reasonable man adapts himself to the world. The unreasonable man persists in trying to adapt the world to himself. All progress, therefore, depends on the unreasonable man." (Bernard Shaw)
×

Notice

The forum is in read only mode.