5. Batch Processing

cliqo includes a number of features that make it ideal for batch processing, including:

  • Default CSV file output format
  • Setting the exit code based on the results of the run

Each of these features will be discussed in the examples below.

5.1. Example 1 - Nightly log of accounts receivable

There are several ways of obtaining a list of accounts receivable:

PS c:\cliqo> .\cliqo report ar
Aged Receivables
2021-03-04
Printed 2021-03-04 11:01:29-08:00

        Current 1 - 30  31 - 60 61 - 90 91 and over     Total
Amy's Bird Sanctuary    200.00          100.00          786.00  1086.00
Bill's Windsurf Shop                                    85.00   85.00
Freeman Sporting Goods                                          0.00
 0969 Ocean View Road                                   477.50  477.50
 55 Twin Lane                                   85.00   85.00
Total Freeman Sporting Goods    0.00    0.00    0.00    0.00    562.50  562.50
Geeta Kalapatapu                                        629.10  629.10
Jeff's Jalopies                                 81.00   81.00
John Melton                                     450.00  450.00
Kookies by Kathy                                        75.00   75.00
Mark Cho                                        314.28  314.28
Paulsen Medical Supplies                                        954.75  954.75
Red Rock Diner                                  226.00  226.00
Rondonuwu Fruit and Vegi                                        78.60   78.60
Shara Barnett                                           0.00
 Barnett Design                                 274.50  274.50
Total Shara Barnett     0.00    0.00    0.00    0.00    274.50  274.50
Sonnenschein Family Store                                       362.07  362.07
Sushi by Katsuyuki                                      160.00  160.00
Travis Waldron                                  414.72  414.72
Weiskopf Consulting                                     375.00  375.00
TOTAL   200.00  0.00    100.00  0.00    5828.52 6128.52

PS c:\cliqo> .\cliqo select customer --where Balance > '0.0' --max 5
1       Amy's Bird Sanctuary    1086.0
2       Bill's Windsurf Shop    85.0
8       Freeman Sporting Goods:0969 Ocean View Road     477.5
9       Freeman Sporting Goods:55 Twin Lane     85.0
10      Geeta Kalapatapu        629.1

5.2. Exit Codes

When cliqo runs successfully, it sets its exit code to 0. See the table below for accessing the exit code using various shells:

Shell Exit Code Variable
bash $?
cmd %errorlevel%
PowerShell $?
   

By checking the exit code for a 0 value, you can ensure the cliqo command ran successfully. Non zero exit conditions are shown below:

Exit Code Description
101 User break ^C
102 Configuration file error
103 Syntax error
104 File error
201 Object creation error
202 Attribute missing
203 Attribute invalid
204 Date invalid
302 Intuit company connection failed
303 QuickBooks exception
304 Query failed
305 Report failed