SCV Extension Data table creation
The Sync SCV Configuration program creates or updates an SCV Extension Data table as
follows:
- Determines the corresponding SCV Extension table
name:
If <current entity>.C_IS_SYSTEM = "T" then <table name> = SC_EXT_<<current entity>.C_NAME> Else <table name> = SUC_EXT_<<current entity>.C_NAME>
- Creates this extension data table by using the columns specified in the
extended_flag
column in the column registry table ifextended_flag
is set:CREATE TABLE <table name> AS ( Planning process columns: All PK columns of the entity core table. // Note that, in order to do this at this stage PK coinstraints // should be synced before starting table generation. Extension columns Defined in the extension properties table Control columns: source NVARCHAR(80) not_in_core NVARCHAR(1) created_by NVARCHAR(80) creation_time DATETIME2(7) modified_by NVARCHAR(80) modification_time DATETIME2(7) id BIGINT NOT NULL );
- Updates extended core views as
follows:
If <current entity>.C_IS_SYSTEM = "T" then: ALTER VIEW SC_V_EXT_<current entity> AS ( SELECT // Calculated column. For each xs_<column_name> in x that has a corresponding <column_name> in c, select one column as follows: COALESCE(x.xs_<column_name>, c.<column_name>) AS res_<column_name> (this will exclude PK columns) // Main column for imported values. For each <column_name> in c, select one column as follows: c.<column_name> AS <column_name> (this will include PK columns) // Extended column for user/override values. For each xs_<column_name> or xc_<column_name> in x, select one column as follows: x.xs_<column_name> AS xs_<column_name> x.xc_<column_name> AS xc_<column_name> FROM SC_<current entity> c LEFT JOIN SC_EXT_<current entity> x ON c.<PK columns 1> = x.<PK columns 1> AND c.<PK columns 2> = x.<PK columns 2> AND . . . ); Else If <current entity>.C_IS_SYSTEM = "F" then: ALTER VIEW SUC_V_EXT_<current entity> AS ( SELECT // Calculated column. For each xc_<column_name> in x that has a corresponding <column_name> in c, select one column as follows: COALESCE(x.xc_<column_name>, c.<column_name>) AS res_<column_name> (this will exclude PK columns) // Main column for imported values. For each <column_name> in c, select one column as follows: c.<column_name> AS <column_name> (this will include PK columns) // Extended column for user/override values. For each xc_<column_name> in x, select one column as follows: x.xc_<column_name> AS xc_<column_name> FROM SUC_<current entity> c LEFT JOIN SUC_EXT_<current entity> x ON c.<PK columns 1> = x.<PK columns 1> AND c.<PK columns 2> = x.<PK columns 2> AND . . . );
Note: This action is mandatory to include newly added properties in the view. - Updates core profile views as
follows:
If <current entity>.C_IS_SYSTEM = "T" then: ALTER VIEW SC_V_<current entity> AS SELECT SC_<current entity>_P.profile_id, SZ_PROFILE.profile_name, SC_V_EXT_<current entity>.* FROM SZ_PROFILE, SC_<current entity>_P, SC_V_EXT_<current entity> WHERE SC_<current entity>_P.profile_id = SZ_PROFILE.profile_id AND SC_<current entity>_P.id = SC_V_EXT_<current entity>.id Else If <current entity>.C_IS_SYSTEM = "F" then: ALTER VIEW SUC_V_<current entity> AS SELECT SUC_<current entity>_P.profile_id, SZ_PROFILE.profile_name, SUC_V_EXT_<current entity>.* FROM SZ_PROFILE, SUC_<current entity>_P, SUC_V_EXT_<current entity> WHERE SUC_<current entity>_P.profile_id = SZ_PROFILE.profile_id AND SUC_<current entity>_P.id = SUC_V_EXT_<current entity>.id
Note: This action is mandatory to include newly added properties in the view. - Rebuilds the PK/BK constraints of the core table to create same constraints for the extension table.