You can have references to external database metadata from a central studio server. Those references may include application objects, table logical definition, and business logic procedures, triggers and scripts.
 

1 External objects definition

External objects are defined with <external-object> tag. It has the attributes below:

  • database: database to obtain the physical info as metadata columns (size, SQL type) and exported keys to print the ER graphic.
  • dict: dictionary where the external object belongs to.
  • code: external object reference code.
  • type: type of object.
  • mode: configures the way data is shown. By default is xml mode.

There are different mode values, depending on object type:

  • Type object:
    • xml: XML statement definition.
    • sql: SQL statement according to database engine.
    • repinfo: object information.
    • docinfo: columns description about object main table.
    • tecinfo: extended columns information of the main table (basic and metadata information as SQL type and size).
    • image: image documented in the object.
    • menupath: Get paths.
    • butinfo: But info.
    • all: Does menupath, repinfo, image, docinfo, butinfo and table model with deep 1 at the same time.
  • Type table, procedure, function and trigger:
    • xml: statement definition.
    • sql: SQL statement obtained from XML code transformation according to database engine.

The following table shows the different modes that each type of external object accepts:

External Object Attributes
type code database dict lang mode
object         xml, sql, repinfo, docinfo, image
object         tecinfo
object         all
table         xml, sql
procedure         xml, sql
function         xml, sql
trigger         xml, sql
script         -

  Required   Optional   N/A

 

1.1 Object

The following example shows a tabbed panel for either XML, SQL, Repinfo, Docinfo, Tecinfo and Image Object definition, taken from the database dictionary wic.

Copy
<tabs>
    <tab active="yes" title="XML">
        <external-object code="wic_image_object" dict="wic" type="object" mode="xml" />
    </tab>
    <tab title="SQL">
        <external-object code="wic_image_object" dict="wic" type="object" mode="sql" />
    </tab>
    <tab title="Repinfo">
        <external-object code="wic_image_object" dict="wic" type="object" mode="repinfo" />
    </tab>
    <tab title="Docinfo">
        <external-object code="wic_image_object" dict="wic" type="object" mode="docinfo" />
    </tab>
    <tab title="Tecinfo">
        <external-object code="wic_image_object" dict="wic" database="wic" type="object" mode="tecinfo" />
    </tab>
    <tab title="Image">
        <external-object code="wic_image_object" dict="wic" type="object" mode="image" />
    </tab>
</tabs>
Example
<select>
    <columns>
        <rowid table='wic_image_object' />, wic_image_object.*
    </columns>
    <from table='wic_image_object' />
</select>
SELECT 
        wic_image_object.rowid, wic_image_object.*
    
  FROM wic_image_object
Repositorio de imágenes para diccionario y Objectos SQL.
wic_image_object
Label Description
Name Image name

  • Default: name(img_data)
Description Image description
Source Image source

  • Default: 0
  • Values:
    • 0: File.
    • 1: Font "Awesome".
    • 2: Font "Material".
Glyph Glyph code
Color HTML color code

Type Image type

  • Default: type(img_data)
Size Image size

  • Default: size(img_data)
Image width Image width

  • Default: width(img_data)
Image height Image height

  • Default: height(img_data)
Image Image
Updated Updated

  • Default: USER
Date created Creation date

  • Default: CURRENT
User updated User that has updated the image

  • Default: USER
Date updated Updated date

  • Default: CURRENT
wic_image_object
Column Type Size Not null Label Description
img_name Nombre Nombre de imagen

  • Default: name(img_data)
img_memo Descripción Descripción de imagen
img_source Origen Origen de la imagen

  • Default: 0
  • Values:
    • 0: Archivo.
    • 1: Fuente "Awesome".
    • 2: Fuente "Material".
img_font_code Glifo Código del glifo
img_font_color Color Código del color HTML

img_type Tipo Tipo de imagen

  • Default: type(img_data)
img_size Tamaño Tamaño de imagen

  • Default: size(img_data)
img_width Ancho imagen Ancho imagen

  • Default: width(img_data)
img_height Altura imagen Altura imagen

  • Default: height(img_data)
img_data Imagen Imagen
user_created Usuario creación Usuario que dió de alta la imagen

  • Default: USER
date_created Fecha creación Fecha de creación

  • Default: CURRENT
user_updated Usuario modificación Usuario que ha modificado el objeto

  • Default: USER
date_updated Fecha modificación Fecha modificación

  • Default: CURRENT
 

1.2 Table

The following example shows a tabbed panel for both XML and SQL Table definition, taken from the database dictionary wic.

Copy
<tabs>
    <tab active="yes" title="XML">
         <external-object code="wic_jrep_form_hide" dict="wic" type="table"/>
    </tab>
    <tab title="SQL">
        <external-object code="wic_jrep_form_hide" dict="wic" mode="sql" type="table"/>
    </tab>
</tabs>
Example
<table name='wic_jrep_form_hide'>

   <!-- COLUMNS -->
   <column name='rep_code' type='char' size='30' required='y' />
   <column name='hide_colname' type='char' required='y' size='30' />
   <column name='hide_colprev' type='char' required='y' size='30' />

   <!-- INDEXES -->
   <primary name='p_wic_jrep_form_hide' columns='rep_code, hide_colname' />

   <!-- FOREIGN KEYS -->
   <foreign name='f_wic_jrep_form_hide1' columns='rep_code, hide_colname' references='wic_jrep_colout' refcols='rep_code,col_name' ondeletecascade='y' />
</table>
-- **************************************************************************
-- DEISTER WebStudio XSQL-SCHEMA Tue Oct 22 06:47:51 CEST 2019 Engine: ids
-- wic_jrep_form_hide
-- **************************************************************************
CREATE TABLE wic_jrep_form_hide (
    rep_code char(30) not null,
    hide_colname char(30) not null,
    hide_colprev char(30) not null
);

-- Database Server on Postgres, DB2 will be created a index automatically with the same name of pk
ALTER TABLE wic_jrep_form_hide
 ADD CONSTRAINT 
 PRIMARY KEY (rep_code, hide_colname);

-- Omitido indice f_wic_jrep_form_hide1 dado que ya existe un indice sobre las columnas 
ALTER TABLE wic_jrep_form_hide
 ADD CONSTRAINT  FOREIGN KEY (rep_code, hide_colname)
 REFERENCES wic_jrep_colout(rep_code,col_name)
 ON DELETE CASCADE ;
 

1.3 Function

The following example shows a tabbed panel for both XML and SQL Function definition, taken from the database dictionary wic.

Copy
<tabs>
    <tab active="yes" title="XML">
         <external-object code="sdm_set_value" dict="wic" type="function"/>
    </tab>
    <tab title="SQL">
        <external-object code="sdm_set_value" dict="wic" mode="sql" type="function"/>
    </tab>
</tabs>
Example
<!-- =============================================================================  -->
<!--                                                                                -->
<!--    sdm_set_value(p_string)                                                     -->
<!--                                                                                -->
<!--    Asignar una constante (valor fijo) a una columna en un trigger no es        -->
<!--    facil, hay que hacerlo via un SPL.                                          -->
<!--                                                                                -->
<!--    Se utiliza en un grupo de disparadores de wic_icon y d wic_iges.            -->
<!--       WIC_ICON: cpar_projecl, cpar_projseg                                     -->
<!--                                                                                --> 
<!-- =============================================================================  -->
<function name='sdm_set_value'>
    <test>
        <unit id='1'>
            select sdm_set_value(<char>'1'</char>) from cdataemp;
        </unit>
    </test>
    <args>
        <arg name='p_string' type='char' size='255' />
    </args>
    <returns type='char' size='255' />

    <body>
        <return>p_string</return>
    </body>
</function>
-- **************************************************************************
-- sdm_set_value
-- DEISTER WebStudio XSQL-UDFUNC  -  Engine: ids
-- **************************************************************************

-- ============================================================================
-- XSQL Tests
-- ============================================================================
-- Unit 1
--              select sdm_set_value('1') from cdataemp;
 

1.4 Procedure

The following example shows a tabbed panel for both XML and SQL Procedure definition, taken from the database dictionary wic.

Copy
<tabs>
    <tab active="yes" title="XML">
          <external-object code="wic_raise_msg" dict="wic" type="procedure"/>
    </tab>
    <tab title="SQL">
        <external-object code="wic_raise_msg" dict="wic" mode="sql" type="procedure"/>
    </tab>
</tabs>
Example
<procedure name='wic_raise_msg'>
    <args>
        <arg name='p_isam'   type='integer'        />
        <arg name='p_strmsg' type='char' size='80' />
    </args>

    <body>

        <exception>p_strmsg</exception>
    </body>
</procedure>
-- **************************************************************************
-- wic_raise_msg
-- DEISTER WebStudio XSQL-UDFUNC  -  Engine: ids
-- **************************************************************************
 

1.5 Trigger

The following example shows a tabbed panel for both XML and SQL Trigger definition, taken from the database dictionary wic.

Copy
<tabs>
    <tab active="yes" title="XML">
         <external-object code="wic_change_log_del" dict="wic" type="trigger"/>
    </tab>
    <tab title="SQL">
        <external-object code="wic_change_log_del" dict="wic" mode="sql" type="trigger"/>
    </tab>
</tabs>
Example
<xsql-trigger name="wic_change_log_del" table="wic_change_log" event="delete">
  <foreach-row>
    <execute-procedure name="wic_raise_msg">
        <in>
            <param>0</param>
            <param>'No esta permitido borrar registros en esta tabla'</param>
        </in>
    </execute-procedure>
  </foreach-row>
</xsql-trigger>
-- **************************************************************************
-- wic_change_log_del
-- DEISTER WebStudio XSQL-TRIGGER Tue Oct 22 06:47:52 CEST 2019 Engine: ids
-- **************************************************************************
 

1.6 Script

The following example shows an XML Script definition, taken from the database dictionary wic.

Copy
<external-object code="wic_jrep_object_buffer_create" dict="wic" type="script"/>
Example
<xsql-script name='wic_jrep_object_buffer_create'>

    <args>
        <arg name='p_rep_code'     type='string'  />
        <arg name='p_user_updated' type='string'  />
    </args>

    <body>
        <!-- Un usuari pot començar una edicio del buffer sempre i quan no estigui ja sent editat. -->
        <update table='wic_jrep_object'>
            <column name='rep_stmt_buffer' text='true'>rep_stmt</column>
            <column name='user_updated'><p_user_updated /></column>
            <column name='date_updated'><date.current /></column>
            <where>
                    rep_code = <p_rep_code />
                AND rep_stmt_buffer IS NULL
            </where>    
        </update>
    </body>
</xsql-script>
 

2 External table graph

The following example shows a tabbed panel for either external reference to table with deep="0" and deep="1" from cvenfach table. This function needs an enterprise database to obtain the physical metadata and table relations. You can specify a different level of deep for the table relations (the exported keys).

External table graph attributes
name database deep
     

  Required   Optional   N/A

Copy
<tabs>
<tab active="yes" title="Graph deep 0">
     <external-table-model deep="0" database="demo_erp" name="cvenfach"/>
</tab>
<tab title="Graph deep 1">
    <external-table-model deep="1" database="demo_erp" name="cvenfach"/>
</tab>
</tabs>
Example
 

3 wic_conf wic_database