Classification Values

Introduction

This pages describes DrawMGT V12.0 handling of classification values. It only includes single-value classifications for a given aspect.

Handling From/To Values

Form field naming in app/js/cascadingSelect.js

    levelCode_{aspectId}            Name of hidden levelCode field
    aspectValueId_{apectId}         Name of hidden aspectValueId field
    code_{aspectId}                 Name of code field for user entry/display

    asp_sel_{aspectId}_{level}      Select field for given level
    asp_val_fr_{aspectId}_{level}   From value for given level
    asp_val_to_{aspectId}_{level}   To value for given level

Nots:

  1. level in the HTML = AspectValues.level - 1

  2. If from/to fields are enabled they appear at all levels. The from/to fields
    • for the levels less that the final level should be ignored. E.g. you only store from/to data for 'leaf nodes'.

Test Data Setup

Setup some test data in MET V12.2 to enable from/to data entry in aspect 1:

  update
    AspectValues
  set
    fromToFlag=1,               -- From/To enabled
    dataTypeId=2                -- INT type
  where
    aspectId in ( 1, 15, 16, 17 ) and
    ( code = '03-000-8-N' or code = '03-000-8-S' );

CGI Request For a To/From Data Entry

Request for classification aspect 0.1 = 03-000-8-N (with from=77 and to=88)

This corresponds to: 03-Surveys --> 0000-Geodetic Surveys --> Ring No --> North

  asp_sel_1_0 => '1@001_003',
  asp_sel_1_1 => '26@001_003_001',              Show/Hide based on asp_sel_1_0
  asp_sel_1_2 => '27@001_003_001_004',          Show/Hide based on asp_sel_1_1
  asp_sel_1_3 => '31@001_003_001_004_001',      Show/Hide based on asp_sel_1_2

  asp_val_fr_1_0 => '',                         Always hidden (by config)
  asp_val_fr_1_1 => '',                         Always hidden (by config)
  asp_val_fr_1_2 => '',                         Always hidden (by config)
  asp_val_fr_1_3 => '77',                       Show/Hide based on asp_sel_1_3

  asp_val_to_1_0 => '',                         Always hidden (by config)
  asp_val_to_1_1 => '',                         Always hidden (by config)
  asp_val_to_1_2 => '',                         Always hidden (by config)
  asp_val_to_1_3 => '88',                       Show/Hide based on asp_sel_1_3

  aspectValueId_1 => '31',                      Hidden

  code_1 => '03-000-8-N',                       Hidden

  levelCode_1 => '001_003_001_004_001',         Hidden

Setting From/To CGI Input in the Classification DB Record

How do you know where to put the from/to values in Classifications table?

E.g. how to saving values from CGI input variables asp_{fr|to}_{aspectId}_{level}

Extract from the Classifications table:

  classificationId              primary key
  objectId                      $drawingId, foreign key to Drawings
  objectTypeId                  1 (Document), foreign key to ObjectSTatusTypeRef
  classificationStatusId        foreign key to ClassificationStatusRef
  ...
  aspectValueId_1               1 ($aspectId)
  code_1                        '03-000-8-N' code_1
  levelCode_1                   '001_003_001_004_001' levelCode_1
  dataTypeId_1                  ?
  uri_1                         NULL (based on dataTypeId_1)
  flag_1                        NULL (based on dataTypeId_1)
  minInt_1                      '77' asp_val_fr_1_3 - based on dataTypeId_1
  maxInt_1                      '88' asp_val_to_1_3 - based on dataTypeId_1
  minFloat_1                    NULL - based on dataTypeId_1
  maxFloat_1                    NULL - based on dataTypeId_1
  minDate_1                     NULL - based on dataTypeId_1
  maxDate_1                     NULL - based on dataTypeId_1
  keyword_1                     NULL - based on dataTypeId_1
  ...

Show the Classifications record corresponding to the selected classification '03-000-8-N':

  select
    classificationId 'cid',
    -- objectId 'oid',
    aspectValueId_1 'av_1',
    code_1,
    levelCode_1,
    dataTypeId_1 'dt_1',
    minInt_1,
    maxInt_1
 from Classifications
 where objectId=134;

+-----+------+------------+---------------------+------+----------+----------+
| cid | av_1 | code_1     | levelCode_1         | dt_1 | minInt_1 | maxInt_1 |
+-----+------+------------+---------------------+------+----------+----------+
|  36 |   31 | 03-000-8-N | 001_003_001_004_001 | 1    |     NULL |     NULL |
+-----+------+------------+---------------------+------+----------+----------+

Determining the Level, Data TypeId and From/To Flag

How to set Classifications.dataTypeId_1 ?

Set based on lookup in DB using HTML variable levelCode_1

    select
      level, fromToFlag, dataTypeId
    from
      AspectValues
    where
      levelCode = '001_003_001_004_001';
    +-------+------------+------------+
    | level | fromToFlag | dataTypeId |
    +-------+------------+------------+
    |     4 |          1 |          2 |
    +-------+------------+------------+

Set as follows:

Pseudo Code for Setting From/To Values in Classifications

Switch on $dataTypeId, approximate psuedo code:

  for( $aspectId = 1, $i <= $maxAspectId, $i++ ) {

    $dataTypeId = .. set as described above
    $fromToFlag = .. set as described above
    $level      = .. set as described above

    switch ( $dataTypeId ) {
    case ClassificationDataTypeRef_FLOAT:
      $toVarMin = 'minFloat';
      $toVarMax = 'maxFloat';
      break;
    case ClassificationDataTypeRef_INT:
      $toVarMin = 'minInt';
      $toVarMax = 'maxInt';
      break;
    case ClassificationDataTypeRef_DATE:
      $toVarMin = 'minDate';
      $toVarMax = 'maxDate';
      break;
    case ClassificationDataTypeRef_TEXT:
      $toVarMin = 'keyword';
      $toVarMax = '';
      break;
    case ClassificationDataTypeRef_URI:
      $toVarMin = 'uri';
      $toVarMax = '';
      break;
    case ClassificationDataTypeRef_BOOL:
      $toVarMin = 'flag';
      $toVarMax = '';
      break;
    case ClassificationDataTypeRef_NONE:
      $toVarMin = '';
      $toVarMax = '';
      break;
    default:
      ..error..

    }



    if ( $toVarMax != '' ) {
      $classifications->setValue( $toVarMin . "_" . $aspectId, $toVal );
    }
    if ( $toVarMax != '' && $fromToFlag ) {
      $classifications->setValue( $toVarMax . "_" . $aspectId, $toVal );
    }

  } // .. end for $i=..

This code is incomplete.

Notes:

  1. This should also handle setting of both min & max if case

    • only one of the from/to values is set (as is done, I think, with chainageFrom/To in V11.3):

      HTML Form

      Database

      From

      To

      From

      To

      unset

      unset

      NULL

      NULL

      unset

      set

      =to

      =to

      set

      unset

      =from

      =from

      set

      set

      =from

      =to

      This is not implemented (but should be)
  2. Should also set the fields corresponding to the non-used data fields to NULL.

ClassificationValues (last edited 2010-03-24 14:13:08 by softxs)

Copyright 2008-2014, SoftXS GmbH, Switzerland