Urgent.News

What's breaking now, across thousands of outlets.

Tech

A customer maintenance form in Uniface 10, part 10 - a CSV import with a dry run, and backing up a SQLite file Uniface keeps o

Part 8 wrote customers to a CSV file. The obvious next request is the reverse: "we have a list from the trade fair, can you load it?". And once an import can write a hundred customers in one click, the next question follows immediately: "and how do I get back to yesterday if it went wrong?". So this part has two services: IMPORT_CUSTOMERS reads the export format back, validates every line with…

Uniface 10 includes a CSV import feature that reads data from a trade fair list and validates it against business rules. The IMPORT_CUSTOMERS service reads the export format, validates every line, and writes a log. A dry run runs this log without changing any data. The BACKUP service copies the database into a folder with a timestamp, keeping the newest n copies.

The BACKUP_IF_DUE feature performs this task at most once per day. An interesting discovery was that the SQLite feature attempted to use did not work in Uniface, as a test log revealed. The CSV format is fixed: ten columns, separated by semicolons, with a header line. The ID column can be empty, and the active status can be Y, N, or empty.

Address columns are optional, and optional address columns create a billing address. The import parses the file line by line, removing the Byte Order Mark (BOM) and converting line endings to Uniface's separator. It treats the text as a list, splitting it into fields using a state machine that handles quotes and semicolons. The SPLIT_CSV function appends fields to a list and counts the columns.

The SPLIT_LINE function is a wrapper for the parser, which is not efficient for large files. Each line goes through the same rules as the IMPORT_LINE form validation, which uses the CUSTOMER_SVC service.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

This story

This is one outlet's version. Read the fullest account.

Read the original at dev.to →

More in Tech

7 checks I run on a number before it goes in front of money

The number that embarrasses you is never the obvious lie. It's the ordinary-looking one everybody nods past, because it's already in the deck and the deadline was yesterday.

  • Determine if the figure is a rate or a score
  • Identify the denominator for accurate comparison
  • Ascertain who selected the sample and excluded participants

More from Sunday 4 October →