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-01-11 Printed 2021-01-11 13:25:17-08:00 Current 1 - 30 31 - 60 61 - 90 91 and over Total Amy's Bird Sanctuary 100.00 786.00 886.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 100.00 0.00 0.00 0.00 5828.52 5928.52
PS c:\cliqo> cliqo select customer --where Balance > '0.0' --max 5 1 Amy's Bird Sanctuary 886.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. Tips for Using With bash¶
When using cliqo with bash, you can pipe the output through other filters such as grep to limit results. In addition, using the –format=json option and the jq utility, you can create more interesting solutions. You might use the following in bash to output 2 customers with a Balance greater than 0:
#!/bin/bash
# List 2 customers with Balance > 0
$cliqo \
--fields=all \
--format=json \
select customer \
--where "Balance > '0.0'" \
--max 2 \
> customers.json
And the following command to extract the customer names:
#!/bin/bash
jq '.customers[] | .FullyQualifiedName' customers.json
5.3. Tips for Using With PowerShell¶
(Pending)
5.4. 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 authorization |
failed |
303 Quickbooks |
exception |
304 Query |
failed |
305 Report |
failed |