Deletions are marked like this. | Additions are marked like this. |
Line 199: | Line 199: |
== Mapping from Drawing Code Components to Classifications == 1. Uses the following tables: * DrawingCodeMapRef - Defines a drawing code component map (basically its name and id) * DrawingCodeMapCodes - Defines the code values allowed for the drawing code component * DrawingCodeMapValues - Defines mapping from the drawing code component values to classification id values |
== Indirect Mapping from Drawing Code Components to Classifications == Suppose a drawing code requires the following indirect mapping: || '''Drawing Code''' ||<-2> '''Mapping''' || || '''Component''' || '''projectPhaseId''' || '''categoryId''' || || A || 101 (1 - Design) || 205 (E - Electrical) || || B || 102 (2 - Construction) || || || C || || 203 (C - Civil) || || D || 103 (3 - Planning) || 205 (E - Electrical) || The indirect mapping uses the following database tables: * '''DrawingCodeMapRef''' - Defines a drawing code component map (basically its name and id) * '''DrawingCodeMapCodes''' - Defines the code values allowed for the drawing code component * '''DrawingCodeMapValues''' - Defines mapping from the drawing code component values to classification id values Define the map, which we arbitrarily call EX1, in the '''DrawingCodeMapRef''' table: ||<-5> '''DrawingCodeMapRef''' || || drawingCodeMapId || code || name || description || define || || 1001 || EX1 || Example Map || null || EX1 || Define the possible component codes, which appear in the component's select list, in the '''DrawingCodeMapCodes''' table: ||<-5> '''DrawingCodeMapCodes''' || || drawingCodeMapId || code || contractId || name || description || || 1001 || A || 0 || Design/E || null || || 1001 || B || 0 || Construction || null || || 1001 || C || 0 || Civil || null || || 1001 || D || 0 || Planning/E || null || Define the mappings of the codes to the target fields in the '''DrawingCodeMapValues''' table: ||<-6> '''DrawingCodeMapValues''' || || drawingCodeMapId || code || contractId || fieldName || valueId || valueChar || || 1001 || A || 0 || projectPhaseId || 101 || null || || 1001 || A || 0 || categoryId || 205 || null || || 1001 || B || 0 || projectPhaseId || 102 || null || || 1001 || C || 0 || categoryId || 203 || null || || 1001 || D || 0 || projectPhaseId || 103 || null || || 1001 || D || 0 || categoryId || 205 || null || |
Drawing Code Handling
- Drawing codes are composed of components, each of which (generally) has a meaning.
- The drawing code components can be mapped to classification (and other fields) in the Drawings record.
- Maps may be direct (to reference tables) or indirect, e.g. via drawing code map tables (see below).
There is a complex syntax described in SomePage (?)
Drawing codes structures are defined in app/config/Settings-DrawingCode.php
Drawing code functionality is implemented in app/lib/DrawingCodeBase.php
Drawing Code Definition
The drawing code definition is defined in:
The database table DrawingCodeTypeRef, where an id, code and name for each drawing code type is defined.
The configuration file app/config/Settings-DrawingCode.php, which defines all the components of each drawing code.
Drawing Code Component Definition
The drawing codes are defined in the $_CFG settings array.
Each Drawing Code has two parts:
DrawingCode - defines each drawing code component and separator
RevisionCode - defines:
- each revision code component
- revision numbering rules (starting revision number, are gaps allowed)
- file storage rules for the publish and source files (how the files are named internally)
Top-Level Configuration
$_CFG[ 'DrawingCodeDefinitions' ] = array( DrawingCodeTypeRef_DC1 => array( // KEJV: 14-C-9.99.999 'name' => 'KEJV', 'drawingCode' => array( // KEJV Drawing code definition 'components' => array( ... ) ), 'revisionCode' => array( // KEJV Revision code definition 'components' => array( ... ) ... ), ), DrawingCodeTypeRef_DC2 => array( // ... ... ), ),
Component Definition
Components are defined as a series of arrays (starting with component zero):
The following example shows a simple document code with three components:
Drawing Code
X
-
9999
Components
Component
Name
Description
X
Category
Engineering discipline, a single character taken from the field CategoryRef.code
-
Separator
Constant text
9999
Sequence
Four-digit sequence number
This is the definition in app/config/Settings-DrawingCode.php
'drawingCode' => array( // Example drawing code definition 'components' => array( array( // Category 'name' => 'Category', 'type' => 'select', 'length' => 1, 'rmTable' => 'CategoryRef', 'rmCode' => 'code', 'rmName' => 'CODE_NAME', 'rmField' => 'categoryId', 'parse' => '/^[A-Z]{0,1}$/', 'pattern' => '/^[A-Z]{1,1}$/', 'fieldOut' => 'categoryId', ), array( // Separator 'type' => 'constant', 'value' => '-', 'parse' => '-', ), array( // Sequence number 'name' => 'Sequence Number', 'type' => 'manual', 'length' => 4, 'formatCode' => '%04d', 'fieldOut' => 'drawingNo', 'formatOut' => '%d', 'parse' => '/^\d{0,4}$/', 'pattern' => '/^\d{1,4}$/', ), ), ),
Notes about the components:
- The category is a select field of a single character, and maps directly to Drawings.categoryId.
- The separator is constant text.
- The sequence number is a manual entry value, which must be numeric. It maps directly to Drawings.drawingNo.
There are many component keywords. The complete list of valid keywords is defined below.
Component Keywords
Keyword |
Description |
counterIn |
Name of counter field (See below) |
fieldIn |
Name of field used for initializing the componenet value |
fieldOut |
Name of field to which the component value should be copied |
formatCode |
Printf style format code used for building the code |
formatIn |
Scanf style format code for converting the component into a value for entry |
formatOut |
Printf style format code used for converting the component into into the destination field |
frameIn |
Name of session frame variable for retrieving the conponent value |
length |
Component length in characters |
mapId |
Id value for an indirect map. Maps to DrawingCodeMapRef.mapId (see below). |
name |
Name of component, use for building a validation tag |
nullClip |
Number of characters to remove from code if this component is empty. For removing separators |
parse |
Length (if numeric), or constant text, or regular expression (if starting with slash character) used to parse/extract the component from user input |
pattern |
Length (if numeric), or regular expression used to parse/extract the component from the code |
readonly |
Set to true if the component cannot be modified |
replaceIn |
Two component array of: 1) search regular rexpresssion, 2) text that it should be replaced with |
required |
Set to false if component is options. Defaults to true if not present |
rmCode |
Direct map: Field name (from target table) to use as value for component (typically code) |
rmField |
Direct map: Target field name |
rmFilter |
Direct map: Filter field name, Typically contractId |
rmFilterValue |
Direct map: Filter constat value. |
rmName |
Direct map: Name of field(s) to display in list (typically, code, name or CODE_NAME) |
rmTable |
Direct map: Target table name |
type |
Component type. See below. |
value |
Constant text for fields of constant type |
Component Types
Type |
Description |
constant |
Component is constant text, typically used for separator characters |
counter |
Component is a numeric counter. (See below) |
manual |
Component is manual entry (e.g. no select list is available). Typically used for sequence numbers |
select |
Component is a select list, requires that a mapping is defined |
Revision Keywords
Keyword |
Description |
firstRevisionNo |
Initial revisionNo value. Typically 0 or 1 |
gapsAllowed |
True is revisionNo gaps are allowed |
publishFilenameFields |
|
publishFilenameFile |
|
publishFilenameFormat |
|
publishFilenameName |
|
publishFilenameReplace |
|
revisionNumberComponent |
|
sourceFilenameFields |
|
sourceFilenameFile |
|
sourceFilenameFormat |
|
sourceFilenameName |
Allowed values: code, format, free. See below |
sourceFilenameReplace |
|
Filename Name Handling
keyword |
Value |
code |
The file must be named exactly according to the document code |
format |
The file name is determined by a regular expression transformation of the drawing code |
free |
The file name unrestricted |
Counters
to be completed
Drawing Code Maps
Drawing code maps allow classification (and other) fields to be directly set based on drawing code components. This is main mechanism for automatically setting classification fields based on a drawing code.
There are two kinds of maps:
Direct maps - map a drawing code component value directly to the code of the target field
Indirect maps - which use DrawingCodeMap tables to map from a drawing code component
- value to one (or more) target field/values pairs.
Examples
Indirect Mapping from Drawing Code Components to Classifications
Suppose a drawing code requires the following indirect mapping:
Drawing Code
Mapping
Component
projectPhaseId
categoryId
A
101 (1 - Design)
205 (E - Electrical)
B
102 (2 - Construction)
C
203 (C - Civil)
D
103 (3 - Planning)
205 (E - Electrical)
The indirect mapping uses the following database tables:
DrawingCodeMapRef - Defines a drawing code component map (basically its name and id)
DrawingCodeMapCodes - Defines the code values allowed for the drawing code component
DrawingCodeMapValues - Defines mapping from the drawing code component values to classification id values
Define the map, which we arbitrarily call EX1, in the DrawingCodeMapRef table:
drawingCodeMapId
code
name
description
define
1001
EX1
Example Map
null
EX1
Define the possible component codes, which appear in the component's select list, in the DrawingCodeMapCodes table:
drawingCodeMapId
code
contractId
name
description
1001
A
0
Design/E
null
1001
B
0
Construction
null
1001
C
0
Civil
null
1001
D
0
Planning/E
null
Define the mappings of the codes to the target fields in the DrawingCodeMapValues table:
drawingCodeMapId
code
contractId
fieldName
valueId
valueChar
1001
A
0
projectPhaseId
101
null
1001
A
0
categoryId
205
null
1001
B
0
projectPhaseId
102
null
1001
C
0
categoryId
203
null
1001
D
0
projectPhaseId
103
null
1001
D
0
categoryId
205
null
Examples
Example component ''languageCode'' for the MET Drawing Code (Indirect Mapping)
In DrawingCodeMapRef:
- id=1002, name='Language Code'
In DrawingCodeMapCodes:
- EN - English
- EH - English/Hungarian
- HU - Hungarian
In DrawingCodeMapValues, if these codes mapped to a classification (which currently they do not), we
can put (nultiple) mappings of target (field, value) tuples. Note that the field refers to the form (? check this)
HU --> Drawings.languageId, 3 (3=Hungarian)
Note that this is not yet implemented for V12.x, e.g. for aspect based classifications.
Example: Mapping Projektphase (c) to ProjectPhaseRef in Axpo/NOK DrawingCode (Direct Mapping)
In app/config/Settings-DrawingCode.php
array( // b (Projektphase) --> projectPhaseId 'name' => 'Projektphase', 'type' => 'select', 'length' => 1, 'rmTable' => 'ProjectPhaseRef', 'rmCode' => 'code', 'rmName' => 'CODE_NAME', 'rmField' => 'projectPhaseId', 'formatCode' => '%d', 'fieldOut' => 'projectPhaseId', 'parse' => '/^[0-9]{0,1}$/', 'pattern' => '/^[0-9]{1,1}$/', ),
Example: Mapping a Subset of Fachbereich (cc) to CategoryRef in Axpo/NOK DrawingCode
The problem is to map a subset of the Fachbereich (CategoryRef table) from a drawing code component to the Fachbereich