TXT Entity need a Key field
Author: benoit.guenette@compuware.com (bguenette)
Hi folks,
I have a little concern with an TXT Entity. Uniface force me too put a Key and I really dont need one. I know that I will have some duplicate on my TXT file and its ok because the interface between my application and the client application is built on that way.
Do you have any idea to help me?
Thanks a lot
Benoit
Hi Benoit,
Did you already check the topic TXT File Handling in the Uniface Library? It should sufficiently answer your question. Here's an extract:
***
[...]
Interface Definitions for Comma-Separated Files
Use interface definitions when handling comma-separated text files. For example, a text file contains the following:
’string1’,’string2’,1200,’string3'
'string4’,’string5’,123,’string6’
The file contains two records. Each record is made of two strings, a number, and another string. The strings are enclosed in quotes, and the fields are separated by commas. The field interface definitions in the entity are shown in the table:
Table 1. Field Interface Definitions
|
Fields
|
Interface Definitions
|
|
Field1
|
C*VI\\’
|
|
Field2
|
C*VI\\’,’
|
|
Field3
|
C*VI\\’
|
|
Field4
|
C*VI\\,’
|
|
Field5
|
C*VI\\’
|
|
Field6
|
C1
|
Field6 is the primary key because the other fields are variable-length character strings, and a variable-length field cannot be a primary key. The VI in the interface definition indicates that a string identifier is used with the record part after the backslash (\\) separator.
The first field starts after a quote character, and the second field starts after the comma. To prevent possible misinterpretation of a single comma, field5 is added to prevent the last comma being added to field4.
[...]
***
Hope this helps.
Best regards,
Daniel
*** Usual disclaimer ***
Author: diseli (daniel.iseli@uniface.com)
TXT Entity need a Key field
Author: benoit.guenette@compuware.com (bguenette)
Hi folks,
I have a little concern with an TXT Entity. Uniface force me too put a Key and I really dont need one. I know that I will have some duplicate on my TXT file and its ok because the interface between my application and the client application is built on that way.
Do you have any idea to help me?
Thanks a lot
Benoit
Hi Benoit,
uniface requires a key field for all non-database entities.
BUT with TXT, this pro-forma field does NOT have to meet the requirements of a real Primary Key.
Duplicates are allowed etc. so any non-variable-length field will do the job.
Success, Uli
Author: ulrich-merkel (ulrichmerkel@web.de)