JVCL Help:TJvCustomCsvDataSet.AppendedFieldCount

From Project JEDI Wiki
Jump to navigationJump to search
JEDI Visual Component Library Help

Search in JVCL Help

 
Search in all projects
 

Summary

Returns number of fields that were automatically appended to the file-in-memory when the file was loaded from the disk.


Pascal

 propertyAppendedFieldCount: Integer;


Description

This CSV data component solves a common problem of flat file data users, which is what to do when new fields need to be added to an existing program that uses CSV file data. The solution this component implements is to allow backwards compatibility with all CSV files that contain a subset of the fields defined by your CsvFieldDef.
For example, suppose you have a file called Users.csv, and it has two columns (NAME,ADDRESS), and you want to add PHONE_NUMBER. The TJvC vDataSet is smart enough to open the old file with only NAME,ADDRESS, and to fix up the CSV file in-memory, so that it now contains the PHONE_NUMBER field. In this case, you can check if this happened to you by getting AppendedFieldCount.
If you call Flush and save the new CSV file, the new field name will be appended to the CSV header (first line of the file), and the file may now be incompatible with other programs if they expect and can only accept the original file fields. Because this automatic upgrading may be a problem, your program may want to warn users before they overwrite a file with a new CSV file that now has more columns than it formerly had.
In practice, this makes database upgrades seamless, in most cases, it requires no special handling from the user.


About

Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page