BCCL Documentation
Index

CSV Formatting

Unlike XML and JSON, which have standardized formatting rules, CSV files lack inherent structure for dates, decimals, and other data types. BCCL applies ISO8601 formatting by default but offers two methods for customizing the output to match your regional or application requirements.

Default Formatting

By default, BCCL formats CSV data using ISO8601 standards:

  • Dates: yyyy-MM-dd (e.g., 2025-03-15)
  • Decimals: dot as decimal separator (e.g., 1234.56)
  • DateTimes: ISO8601 format (e.g., 2025-03-15T14:30:00)
  • Times: HH:mm:ss format (e.g., 14:30:00)

This is generally the safest choice for data interchange and automated processing.

Method 1: Language ID Parameter

The -a (or --language) parameter applies regional formatting rules to all fields in the export.

Usage

BCCL -t getdata -s table=18 -f csv -a 1030 -o customers.csv

This example applies Danish formatting (Language ID 1030), which results in:

  • Dates formatted as dd/mm/yyyy
  • Commas used as decimal separators
  • Periods used as thousand separators

Common Language IDs

Language ID Language Date Format Decimal Separator
0 ISO8601 (default) yyyy-MM-dd .
1030 Danish dd/MM/yyyy ,
1031 German dd.MM.yyyy ,
1033 US English M/d/yyyy .
1036 French dd/MM/yyyy ,
1043 Dutch d-M-yyyy ,
1044 Norwegian dd.MM.yyyy ,
1053 Swedish yyyy-MM-dd ,

Notes

  • The language ID affects only CSV output formatting
  • JSON and XML always use standard formatting regardless of language setting
  • The same language IDs are used in Business Central for localization

Method 2: Format Attribute in Mapping Files

For more granular control, you can apply .NET format strings to individual fields within mapping files. This gives you field-by-field formatting control.

Decimal Formatting

Add a "Format" property to a field in your mapping file:

{
    "FieldNo": 20,
    "FieldName": "Credit Limit (LCY)",
    "MappedName": "Credit_Limit__LCY_",
    "Format": "F4",
    "Validate": true
}

The "F4" format code specifies four fixed decimal places. This produces values like 1234.5600.

Common Decimal Format Strings

Format Description Example
F0 No decimal places 1235
F2 Two decimal places 1234.56
F4 Four decimal places 1234.5600
N2 Two decimals with thousands separator 1,234.56
C2 Currency format $1,234.56

Date Formatting

{
    "FieldNo": 20,
    "FieldName": "Posting Date",
    "MappedName": "Posting_Date",
    "Format": "yyyy-dd-MM",
    "Validate": true
}

Common Date Format Strings

Format Description Example
yyyy-MM-dd ISO date 2025-03-15
dd/MM/yyyy European date 15/03/2025
MM/dd/yyyy US date 03/15/2025
dd-MMM-yyyy Day-Month name-Year 15-Mar-2025
yyyyMMdd Compact date 20250315
yyyy-MM-dd HH:mm:ss Date with time 2025-03-15 14:30:00

Combining Both Methods

You can use the language ID parameter and format attributes together. The format attribute on a specific field takes precedence over the language-based formatting for that field:

BCCL -t getdata -s table=18 -f csv -a 1030 -m mapping.json -o output.csv

In this case, all fields use Danish formatting except those with an explicit Format property in the mapping file.

Delimiter Configuration

The default CSV delimiter is a comma (,). Use the -l parameter to change it.

Common Delimiters

# Tab-separated (TSV)
BCCL -t getdata -s table=18 -f csv -l "\t" -o output.tsv

# Pipe-separated
BCCL -t getdata -s table=18 -f csv -l "|" -o output.csv

# Semicolon-separated (common in European locales)
BCCL -t getdata -s table=18 -f csv -l ";" -o output.csv

Special Delimiter Characters

Escape Sequence Character
\t Horizontal tab
\n New line
\r Carriage return
\0 Null character
\a Alert
\b Backspace
\f Form feed
\v Vertical tab
&#\; Backslash

Notes on Tab Delimiters

When using tab as a delimiter (-l "\t"), BCCL automatically omits quote characters around field values. This produces clean TSV files:

No.	Name	City
10000	Adatum Corporation	Miami
20000	Trey Research	Chicago

Quote Character Configuration

Changing the Quote Character

Use -c to specify a different quote character:

BCCL -t getdata -s table=18 -f csv -c "'" -o output.csv

This wraps values in single quotes instead of double quotes.

Ignoring Quotes

Use -q to treat quote characters as literal text rather than field delimiters:

BCCL -t getdata -s table=18 -f csv -q -o output.csv

Header Row Control

Including Headers (Default)

By default, BCCL includes a header row with column names:

BCCL -t getdata -s table=18 -f csv -o output.csv

Output:

"No.","Name","City"
"10000","Adatum Corporation","Miami"

Excluding Headers

Use -h false to omit the header row:

BCCL -t getdata -s table=18 -f csv -h false -o output.csv

Output:

"10000","Adatum Corporation","Miami"

Important: Headers are required when importing CSV files with PUTDATA. Without headers, BCCL cannot match columns to fields.

UTF-8 Encoding

BCCL outputs all files as UTF-8 and expects all input files to be UTF-8 encoded. If your CSV files contain special characters (accented letters, non-Latin scripts), ensure they are saved in UTF-8 encoding.

Tips and Best Practices

  • Use ISO8601 formatting (default) for data interchange and automated processing
  • Use language IDs when generating files for end users in specific regions
  • Use format attributes for precise control over individual fields
  • When using European locales with comma decimal separators, change the delimiter to semicolon or tab to avoid conflicts
  • Always use UTF-8 encoding for CSV files
  • Include headers unless you have a specific reason not to