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

Este es el repositorio de imágenes que ilustra el diccionario (incluidos los menús) y los objetos SQL.

Estas imágenes se pueden obtener por medio de un archivo o de iconos empaquetados en una fuente. Los iconos parecen imágenes, pero se pueden manejar como fuentes.

Debido a las propiedades de color y escalabilidad de las fuentes, se debe priorizar el uso de iconos en lugar de imágenes.

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 (hieroglyphic): when the source is a font, enter here icon code from the website.

Color Color: when the source is a font, select here desired color for the icon.

If no color is selected, the system will display the icon in black or white depending on the darkness/lightness of the background.



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 Choose file: when you select this options, standard opening dialog box appears and an image file can be selected. After unloading image, the fields Size, Type, Width and Height will be automatically filled in.
Created by The user who has created the record

  • Default: USER
Date created Date of registering

  • Default: CURRENT
Modified by The last user who has updated the record

  • Default: USER
Date updated Date of the last update

  • 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 Fuente*: seleccione entre las tres opciones según el origen de la imagen.
  • Archivo: un archivo de imagen.
  • Fuente "Awesome": Font Awesome es una gran colección de iconos. Acceder al Font Awesome website, seleccionar el icono deseado y copiar el código del icono.
  • Fuente "Material": Material Design Icon es un conjunto completo de iconos oficiales de diseño de material, creado y mantenido por Google, para gráficos vectoriales escalables en sitios web o computadoras de escritorio. Acceder al Material Design Icon website, seleccionar el icono deseado y copiar el código del icono.


  • Default: 0
  • Values:
    • 0: Archivo.
    • 1: Fuente "Awesome".
    • 2: Fuente "Material".
img_font_code Glifo

Glifo (jeroglífico): cuando el origen sea una fuente, insertar aquí el código de icono del sitio web.

img_font_color Color Color: cuando el origen es una fuente, seleccionar aquí el color deseado para el icono.

Si no se selecciona ningún color, el sistema mostrará el icono en blanco o negro dependiendo de la oscuridad/claridad del fondo.



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 Elegir archivo : cuando selecciona esta opción, aparece el cuadro de diálogo de búsqueda de archivos estándar y se puede seleccionar un archivo de imagen. Después de descargar la imagen, los campos Tamaño, Tipo, Ancho y Altura se completarán automáticamente.
user_created Creado por Usuari que ha creado el registro

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

  • Default: CURRENT
user_updated Modificado por Último usuario que ha modificado el registro

  • Default: USER
date_updated Fecha modificación Fecha de la última 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 Thu Jul 09 22:27:01 CEST 2020 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 Thu Jul 09 22:27:02 CEST 2020 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