2: Context ID Position Statement
6: Context ID Statement - Fixed-Width Formatting
Data Files - CSV Format vs. Fixed-Width Format
6: Context ID Statement - CSV Formatting
The data below describes the context ID statement, identifies CSV field references, provides excerpts from sample data and DEF files, and helps you interpret a sample DEF file:
In the definition file, the next block of lines begins with CONTEXT and ends with ENDCONTEXT. This tells the import program that a new block of text (to define a new set of records) is included in that block.
The first line, beginning with CONTEXT, shows the record type that the system recognizes, whether the records are Header or Detail, and the Context ID.
In the following example, Sessions are imported, all records are Header records, and the Context ID to be used is HSESSN.
CONTEXT,SESSION,HEADER,HSESSN
SESSION_SESSIONNUMID,,AUTONUM
SESSION_STATUS,,BP
SESSION_DESCRIPTION,,Import from RE
SESSION_SESSIONDATE,2,,mm/dd/yyyy
SESSION_TRANSSOURCEID,,CR
ENDCONTEXT
The number of characters identified for the Header—"HSESSN" in this example—cannot be longer than the Context ID position (6 in this case), which is declared in the Context ID Position statement in the Environment section.
Field references are located between the CONTEXT and ENDCONTEXT statements. They contain seven field positions, separated by commas and read from left to right. The following table outlines each possible field position:
Field Position | Comma Separated Variable |
---|---|
1 |
Context Type and Field Name |
2 |
Field Position in CSV |
3 |
Default Value |
4 |
Date Mask |
5 |
Position within string |
6 |
Field Length |
7 |
Assumed Decimal Places |
Note: Field reference positions are different for fixed-width and CSV data files. See the section entitled "Context ID Statement—Fixed-Width Formatting" for fixed-width examples.
Here is an example of a field reference from a definition File:
1 | 2 | 3 | 4 | 5 | 6 | 7 |
---|---|---|---|---|---|---|
SESSION_SESSIONDATE, |
2, |
, |
mm/dd/yyyy, |
, |
, |
Below you will find three sections related to CSV Formatting—a sample data file, a sample definition file, and an interpretation table. All of this information is related to each other—the sample definition file can be used to import the sample data file. And, the Interpretation table outlines how the information is being read by the system.
The following lines are from a sample data file. Notice that commas separate each field of data:
01-101-40001-101-101-1,04/06/2001,C,1000,FAS Fund-CA
01-101-11001,04/06/2001,D,1000,FAS Fund-CA
01-101-40001-101-101-1,04/06/2001,C,1000,Travel-CA
01-101-11001,04/06/2001,D,1000,Travel-CA
Note: We recommend limiting your data to strictly alphabetic characters (A through Z) or numeric characters (0 through 9), and avoiding the use of symbols.
Below is an excerpt from a DEF file. This is NOT a complete definition file; it only contains the Context ID Statement for instructional purposes. It is mapped to the preceding sample data file.
CONTEXT,TRANSENTRY,DETAIL,DDOC
TETRANS_SESSIONNUMID,,Autonum
TETRANS_DOCNUM
TETRANS_DESCRIPTION,7
TETRANS_ENTRY_TYPE,,N
TETRANS_EFFECTIVEDATE,2,,mm/dd/yyyy
TETRANS_SEGMENT_GL,1,,,8,5
TETRANS_SEGMENT_Grant,1,,,4,3
TETRANS_SEGMENT_Fund,1,,,1,2
TETRANS_SEGMENT_Progr,1,,,14,3
TETRANS_SEGMENT_Dept,1,,,18,3
TETRANS_SEGMENT_117,1,,,22,1
TETRANS_DEBIT,4,0,,,,0
TETRANS_CREDIT,4,0,,,,0
ENDCONTEXT
Based on the definition file below, and the first line in the preceding sample data file, here is how the system reads the data:
Field Name | Field Pos | Default | Date | String Pos | Length | Decimal | 1st Line Actual Data |
---|---|---|---|---|---|---|---|
TETRANS_ |
N/A |
||||||
TETRANS_DOCNUM |
N/A |
||||||
TETRANS_ |
5 |
FAS Fund-CA |
|||||
TETRANS_ |
N |
||||||
TETRANS_ |
2 |
mm/dd/yyyy |
04/06/2001 |
||||
TETRANS_ |
1 |
8 |
5 |
40001 |
|||
TETRANS_ |
1 |
4 |
3 |
101 |
|||
TETRANS_ |
1 |
1 |
2 |
01 |
|||
TETRANS_ |
1 |
14 |
3 |
101 |
|||
TETRANS_ |
1 |
18 |
3 |
101 |
|||
TETRANS_ |
1 |
22 |
1 |
1 |
|||
TETRANS_DEBIT |
4 |
0 |
0 |
||||
TETRANS_CREDIT |
4 |
0 |
0 |
1000 |
Field Name This is the field name that is required by the Import program. It cannot be changed.
Field Position in CSV File This is the order in which the fields are organized. Unlike fixed-width data files, CSV files are organized by fields, not characters.
An account code will generally appear as a string in a single field. Within that field, identify the start position and length for each of the segments.
Default Value Specify a default value; however, this is not required.
Date Mask Indicate the format for date fields—MMDDYY, MMDDYYYY, MM/DD/YYYY, or MM-DD-YYYY.
Position within String Use this designation to specify the begin position of subsets within a field.
Field Length This is the length of the data position within the field. This length was assigned when the organization was created. If the data length exceeds the field lengths specified, the system displays an error to that affect.
Assumed Decimal Places Indicate the number of decimal places in currency fields. If the decimal is supplied with the data, enter 0.