


Collection_Map_Create
| Collection_Map_Create(
|
|
| <type>
| // Reserved; use ""
|
| , <edi_doc>
| // String specifying the EDI Transaction set identifier and version, e.g. “210-3040”.
|
| , <data>
| // The name, in quotes, of a memory variable, which contains one entire
(ST-to-SE) transaction.
|
| , <seg_delim>
| // Literal or expression evaluating to the segment delimiter character(s),
e.g. Chr(10), CRLF().
|
| , <field_delim>
| // For example, “*”.
|
| , <calc_fields>
| // Quoted, bracketed list of calculated fields to be appended to c_Feed.
|
| , <output>
| // Reserved; use ""
|
| )
|
|
Collection_Map_Create(
""
, '210-3040'
, 'mvTrans'
, Chr(10)
, '*'
, '[C1][C2][Elem_Type:
Toggle("Tmp_Elem_Type"
, "Off"
, Left(SELF![RCRD_TYPE],2)="LX"
, InStr(1,"SE,L3",Left(SELF![RCRD_TYPE],2)) <>0
, "LI"
, "FB")]
'
, ""
)
Notes
Processing
Conceptually,
Collection_Map_Create() acts as follows:
1. It first instantiates
Collection c_Feed, which has attributes:
2. Next,
Collection c_Map is initialized. This collection has the same attributes as c_Feed. For each row in c_Feed, there is a corresponding row in c_Map, with the same values for LINE_NUM, RCRD_TYPE, and the attributes instantiated in the calc fields. All of the FIELD_NN values in c_Map are set to the corresponding c_Feed values prefixed with ":=".
3. Then
Collection c_Map is embellished according to formulas contained in cells in the pre-defined in the MAP_RCRD table.
4. Formulas in the cells of the
MAP_RCRD table.
Table MAP_RCRD
This table has five columns:
| OWNER_KEY
| 000-0000 means "all customers".
|
| MAP_DOC_VER
| MAP (EDI) Document Type and Version Number, e.g. 210-3040.
|
| VEND_LABL
| SCAC Code or equivalent, "*" means "Generic" to all vendors.
|
| RCRD_TYPE
| The Record Type (EDI segment type) for which this concept applies.
|
| FIELD_EXPR_NN
| NN = 01 to 25. Note that the assignment operator , := , is newly available for use in expressions in this table.
|
Collection_Map_Create "walks" table
MAP_RCRD. For each row, the value of RCRD_TYPE matches to the rows in c_Map with the same value of RCRD_TYPE. Along each row, each NN column matches to the corresponding FIELD_NN column in c_Map. For a formula in a MAP_RCRD cell, there is an implied correspondence to a row(s), and one column in c_Map.
Cell Formulas
Each cell may contain one of five types of formulas: A,B,C,D,E
| Type A
| Type A is a quoted string containing the name of a memory variable. Example "INV_NUM".
A Type A formula is used to effect a simple direct assignment: from the value of a particular field in c_Feed to some memory variable (the variable is dynamically instantiated if required). Suppose MAP_RCRD(B3,01) contains "INV_NUM". The function matches RCRD_TYPE B3 and column 01 in c_Feed. For every B3 row in c_Feed the function extracts the value from FIELD_01 and writes this value to the corresponding row and column in c_Map, prefixed with INV_NUM:=, thus the c_Map cell displays explicitly the assignment that was made -- a trace of the function. The memory variable INV_NUM will have the value of the final assignment, i.e. column 01 for the last B3 row in c_Feed. Thus the normal use of a Type A formula is for row types that occur only once in c_Feed, as is the case for a B3 segment in EDI data, so that the "last B3 row" is also the "first B3 row. |
| Type B
| The direct assignment of a value to a memory variable: "FB_AMT":=<expr>.
Suppose MAP_RCRD(N9,04) contains "FB_AMT":=17.50. Then for every N9 record in c_Feed, the corresponding row in c_Map has the value of FIELD_04 set to "FB_AMT":=17.50. The memory variable FB_AMT is left with the value of the last assignment expression --17.50. |
| Type C
| The assignment of a value to a cell of a collection. This has the form:
"<coll name>[<r_exp>][<c_exp>]":=<val_exp> where: <coll_name> Begins with c_, e.g. c_FB, and names a Collection. <r_exp> Expression which evaluates to a row number. <c_exp> Expression which evaluates to a column name or a column number. If [<r_exp>] is omitted, then row 1 is assumed, e.g. c_FB[7] refers to column 7 of row 1 in c_FB. If the referenced cell does not exist in the collection, it is instantiated. If :=<val_exp> is omitted from the formula, then the value is obtained from c_Feed, in the same manner as for a Type A formula. |
| Type D
| A repetition of Type A, B, C values, separated by brackets:
["ZZ"]["FB_AMT":=0]["X1":=1.98]["c_FB[117][151]":="NONE"] The content of every bracket is applied as a Type A or B or C formula, in succession. |
| Type E
| An expression when evaluated, produces a formula of Types A-D. The result of
the expression is applied according to the formula type of the result. The
expression may dynamically determine the l-value of the assignment statement.
|
This table is private to the auxiliary function
Map_QConcept. It has the following columns:
| OWNER_KEY
|
|
| MAP_DOC_VER
|
|
| VEND_LABEL
|
|
| QUAL
| The qualifier of an EDI segment, e.g. “SH”, “CN”.
|
| RCRD_TYPE
|
|
| RCRD_FIELD_NUM
| Field Number.
|
| CONCEPT_EXPR
| A list of expressions (usually one) whose interpretation is specific to
Collection_Map_Create( ).
|
Expressions contained in formulas in the cells of table
MAP_RCRD may use the this function. It takes a single argument, the value of the qualifier, e.g. Map_QConcept("SH").The function returns the value of the field
CONCEPT_EXPR from one row in table MAP_CONCEPT. The row is selected using the following values:
| OWNER_KEY
| From context.
|
| MAP_DOC_VER
| From context.
|
| VEND_LABEL
| From context.
|
| QUAL
| The explicit function argument.
|
| RCRD_TYPE
| For the cell which contains the formula which is invoking the function.
|
| RCRD_FIELD_NUM
| The value of "NN" in the column name FIELD_EXPR_NN which contains the formula which is invoking the function.
|