This section is about the process of how to create 4 different objects connected between them. First of all, the example is based on a wic called wic_form, used in order to register all information in a dictionary. All objects have been added on a data base called Formación Demo.

1 Introduction

This explanation is based on a basic example of a garden structure with 4 objects:

  • Object 1 garden: this is the "parent" object of gardenl and the head of the structure. User can introduce information like id, code, name, type and age.
  • Object 2 gardenl: this is a "child" table of garden. Depends on the garden that it has been selected, it will be shown different information.
  • Object 3 plant: this is a "master table" connected with object gardenl.
  • Object 4 category: this is a "master table" connected with object plant. Depends on which plant it has been selected, it will belong to a different category.

It is important to remain this concepts before writing definition code:

  • Primary Key: single-value column. It use to be an id.
  • Foreign: it refers to extern keys. This function is useful to connect two or more objects.

1.1 Object garden

This is the "parent" object of gardenl where it can be searched different gardens by writing id, code, name, type or age.

Copy
<table name="garden">

	<!-- COLUMNS -->   
	<column name="garden_id"   type="serial"   required="y" />
	<column name="garden_code" type="char"     size="6"  required="y" />
	<column name="garden_name" type="varchar"  size="40" required="y" />
	<column name="garden_type" type="varchar"  size="40" />
	<column name="garden_age"  type="smallint" />
 
 	<!-- PRIMARY KEY -->   
    <primary name='p_garden' columns='garden_id' />
</table>
gardenl
Label Description
Id jardín Id jardín
Id planta Id planta
Id lineas Id lineas
Posición X Posición X
Posición Y Posición Y
Fecha de plantación Fecha de plantación
Fecha ultima visita Fecha última visita
plant_name
category_desc
garden_code
plant_code

1.2 Object gardenl

This is the "child" of garden's object. Depends on the garden that it has been selected, different information will be able in this object. Moreover, this object is related with garden and plant through columns "garden_id" and "plant_id", respectively, as it can be seen on foreign code.

Copy
<table name="gardenl">

	<!-- COLUMNS -->   
	<column name="garden_id"   type="serialref"   required="y" />
	<column name="plant_id"    type="serialref"   required="y" />
	<column name="linid"       type="serial"      required="y" />
	
	<column name="plant_x"      type="smallint" />
	<column name="plant_y"      type="smallint" />
	<column name="plant_date"   type="date" />
	<column name="plant_trim_date"   type="date" />
 
 	<!-- PRIMARY KEY -->   
    <primary name='p_gardenl' columns='linid' />
    
    
    <foreign name="f_gardenl1" columns="garden_id"  references="garden"  refcols="garden_id" />      

    <foreign name="f_gardenl2" columns="plant_id"  references="plant"  refcols="plant_id" />  
    
</table>
gardenl
Label Description
Id jardín Id jardín
Id planta Id planta
Id lineas Id lineas
Posición X Posición X
Posición Y Posición Y
Fecha de plantación Fecha de plantación
Fecha ultima visita Fecha última visita
plant_name
category_desc
garden_code
plant_code

1.3 Object plant

This is a "master table" which is connected with category's object from "plant_cat".

Copy
<table name="plant">

	<!-- COLUMNS -->  
	<column name="plant_id"     type="serial"            required="y"   />
	<column name="plant_code"   type="char"    size="10" required="y"   />
	<column name="plant_cat "   type="char"    size="10" required="y"   />
	<column name="plant_name"   type="char"    size="40" required="y"   />
	
	<column name="plant_family" type="varchar" size="40"               />
	<column name="plant_origen" type="varchar" size="40"               />
	<column name="plant_color"  type="varchar" size="40"               /> 
	
	<column name="plant_sun"  type="smallint"                /> 

	<!-- PRIMARY KEY -->   
	<primary name="p_plant" columns="plant_id" />

 
	<!-- FOREIGN KEYS -->
    <foreign name="f_plant1" columns="plant_cat"  references="category"  refcols="category_code" />      
    
</table>
plant
Label Description
Id Id planta
Código planta Código planta
Categoría de planta Categoría de planta
Nombre de planta Nombre de planta
Planta família Planta família
Planta origen Planta origen

  • Values:
    • Africa: Africa.
    • America: America.
    • Asia: Asia.
    • Europa: Europa.
    • Oceania: Oceania.
Planta color Planta color
Necesitará sol Necesitará sol

  • Default: 1
  • Values:
    • 0: No.
    • 1: Sí.

1.4 Object category

Finally, object category, which is also a "master table" is connected with plant.

Copy
<table name="category">

    <!-- COLUMNS -->  
    <column name="category_code" type="char"       size='10'      required="y" />
    <column name="category_desc" type="varchar"    size='40'      required="y"   />

    <!-- PRIMARY KEY -->   
    <primary name="p_category"  columns='category_code' />

</table>
category
Label Description
Código Código
Categoria Categoria

2 How introduce objects in a wic

When it has been writted all codes, is needed to introduce them in a wic (dictionary). In this case, it has been inserted them in a wic called wic_form located on Explorer application.

After that, user has to select "dictionary", "physical" and "tables":



It is necessary to press "next" and introduce all codes of each object by pressing clean and insert tools:


When it has been introduced all objects, it is necessary to create automatically each object by pressing on "deployment" in the main menu of the wic. Then, with compile models tool, all objects will be introduced. Each object has to be introduced by ordered, depends on which is the "parent" and depending on foreign keys too. In this case, garden and category objects have to be the first ones.

Next stage consists in introducing which database comes from and the name of each object.

After that, all 4 objects will be compiled.


3 How introduce objects in a data base

When all tables have been compiled, it is necessary to build them on a data base. First of all, search the name of data base on Dbstudio application and look for the name of the objects. After that, click on the right button of the mouse and select "build object" and do the same to all objects.


All objects will be builded. If it is needed to check if they are builded, it can be checked on data base Formación Demo. Then, the name of the object must be introduced on the searcher.



4 Enter information in master tables

After build all objects on data base called Formación Demo, all information must be introduced in plant and category as they are "master" objects relationed with gardenl object. In order to introduce all information, different types of plants must be registered and then, all different categories too, depending on plant object.

It's possible to see an example bellow of how insert new information on plant's object.


5 Relate all objects

When it has been introduced all information in masters objects, user can search (in this case) garden's object and introduce all different details, (id, code, name, type).

Now, as gardenl is a form which belongs to garden, it must be inserted by pressing on the pencil tool located on the right hand of the screen. By pressing this tool, the structure of this object will be shown. Click on Form Layout in order to create a new relation between garden and gardenl.

A new Sql table has to be introduced by pressing on SQL table tool and introducing the code on Layout Design. This code must be the same of gardenlobject. In addition, property JOIN must be introduced in order to make the relation between this object and others. In this case, join property is the relation between gardenl, plant and category, as it can be seen on the next image:


After that, it is necessary to complete all information on SQL table output.

It is important to know that Hide Condition (1 == 1) is only necessary when hidden box is required. Also, order must start with 0 and must be followed by even numbers (0, 2, 4,...). Next information is all about columns' names. You can see all process on the next video.

After doing this, gardenl will be connected with garden parent and also gardenl with plant and category.



6 Create a folder on data base

If it is necessary, it can be created a folder with all objects in order to make it more accessible. First of all, click on data base located on Explorer application, in this case, Formación Metadata.

Then, press on menu located on the left side of the screen and it will be showed the following form:



  1. Root folder: name of the main folder.
  2. Icon: it can be choosed which type of menu is it, for example, a transactional menu (in order to connect different folders).
  3. Subfolder: this is the name of a folder contained within another folder.
  4. Sub-menu: name of the menu that is contained within another menu.
  5. Type: it can be choosed which type it is needed. If it is a main folder it must be tree type.

7 Editing tags

An other option that user can do after relating all objects is edit tags by clicking on a tag with right button of the mouse and selecting "edit label". Then, user must complete all information about language, country, label and description as it can be seen on the next image:


8 Add object manually

If user wants to insert plant object manually, it is necessary to add another SQL table as it have been done with relating objects. On the SQL code, user must complete all columns of the object (in this case, plant) and insert where condition.



As it can be seen on the image above, it is really important to relate this object with its parent with option "related box" and introducing parent id number (in this case it is the number of gardenl object).

After that, if you want a multiple selection, you can choose this option by clicking on "multiple" on gardenl object. By doing this action, user can select more than one plant on gardenl and all details are shown on plant object.


9 Garden Dashboard

This section is about how develop garden object. First of all, all objects (from garden) are copied from database system to WIC system in order to be modified.


Garden object is introduced and copied on the system. Some columns from plants and characteristics tables have been used too. Main purpose of this section is creating a new object called dashboards which is an object with all Master's garden objects information.



  1. Clean all data in order to copy the object.
  2. Copy SQL sentence.
  3. Add colums needed to the form.
  4. Change name of the object.
  5. Click on Plus symbol to add on the system.

  1. Add colums on Output.
  2. Insert.

9.1 Layout and Layout_design


  1. It is necessary to click on Form Layout button in order to create graphic box which is going to be visualized.
  2. it is possible to create a different BOX, Box data type, and Grafics (Pie and Cartesian in this case).




9.2 Final Result


  1. Final result is a dashboard with all information.