The preceding sections describe how to set a dataport to import data from an external file in a fixed format. However, you can also import data with variable format.
Property | Value |
---|---|
Import | Yes |
FileFormat | Variable |
FieldSeparator | , |
FieldStartDelimiter | |
FieldEndDelimiter |
Note |
---|
The values of the StartPos and Width properties are not used in a dataport with a variable format. If the order of the fields in the import file is different from the order of the fields in the data item, then you must change the order of the fields in the data item by adding them manually in Field Designer. |
When you run the dataport, the result is the same as running the dataport with a fixed format.
It is easy to make errors when deciding how to parse the lines in the file that you are importing. In some cases, this will result in a run-time error when the dataport is run, such as if you make an error in setting up the Field No. field and assign it a width that is one character too wide. For most of the import file, this would make no difference because the resulting trailing space would be ignored. But in a line that starts with 112Oven, you would get a run-time error when C/SIDE reads 112O instead of 112. The letter O cannot be inserted into an integer field.
In other cases, the error might not be detected by C/SIDE, such as if the parse between two text fields is placed incorrectly. Always test your imports carefully before using them for production.
In some cases, the fields have a different order in your table than they do in the file that you are importing. You can add the fields manually and ensure that the design of the data item reflects the order that you need. You must set the StartPos and Width properties manually.