This type of box is used to represent the information returned by an SQL query, placing said information in a calendar.

1 Parameters



1.1 Main box

Label Description
Id. Box identifier

  • Default: THIS
Cache Flag to keep the quey in the memory cache area (activated by default)

  • Default: 1
  • Values:
    • 1: Yes.
    • 0: No.
Init View Calendar view for showing when the calendar is loaded.

  • Default: 0
  • Values:
    • 0: Month.
    • 1: Week.
    • 2: Day.
Month Enable month view

  • Default: 1
  • Values:
    • 1: Yes.
    • 0: No.
Week Enable week view

  • Default: 1
  • Values:
    • 1: Yes.
    • 0: No.
Day Enable day view

  • Default: 1
  • Values:
    • 1: Yes.
    • 0: No.
Initial day
Event title Column containing the titles of events.
Event description Event description.
Event start Column containing the starting dates of events.
Event end Column containing dates ending events.
All day Indicates that the event duration occupies all day.
Background color Column containing the background colors.
Color Column containing the color of the letters of the event.
Class description Column containing descriptions of classes.
SQL Stmt The SQL statements within the SQLTABLE build the syntax of the query that the system will perform to the database, in the at runtime from parent to which the SQLTABLE.

The syntax of the sentence can be expressed in XML or in standard SQL, without any limitation of lines, text fragments or instructions. The definition of the statement in XML has several advantages:
  • Portability . A statement expressed in XML allows the managers run it on databases of different manufacturers (Informix, BD2, Oracle, etc..).

    If the sentence is coded in standard SQL then it can be executed successfully for the given language, but it may not be feasible for other languages, and it depends on the functions and commands used in the sentence itself.

  • Security . If the statement is expressed in XML, the system will analyze if the userexecuting the sentence, has been restricted with a security role for the objects (tables) involved in the clause "FROM" of the statement, ( provided that the 'joins' definition are not of type "OUTER" neither "LEFT JOIN" ). If so, the system automatically inherits the conditions coming from that role 'profile' and adds them to the clause "WHERE" of the statement during its application.
By other hand, we have to take into account a number of important considerations from the own system. Namely:
  • temporary tables . In the event that it is desired to use temporary tables in the course of the execution SQLTABLE, the name given to the same character must be preceded @ .

    Failure to observe this premise, if a user runs the main subject on two consecutive occasions, in the second the system will an error that the temporary table already exists in the database and you can not continue execution. Through this methodology avoids this problem can be run as often as desired object.

  • Fields main object . Typically a SQLTABLE consists in obtaining information related to a main object registration, hence in clause "WHERE" indicating the restriction by reference to fields the main purpose for which these fields must be preceded by the character # .

  • Variables query . If the main object has associated query variables, the possibility of be inherited and used in a SQLTABLE.

    How to integrate the variables will depend on the type of variable, so see the information about the query variables available on the subject. In any case, irrespective of the nature of it, it will be indicated by the name that has been assigned the character preceded $ .

    If the SQL statement would include unregistered and some variable associated with the object, the system will stop execution same warning in such circumstances.

  • Selection Criteria . When the main object has associated fields input these will be used to formulate user selection criteria at the time of the execution of the object.

    There is the possibility to establish a SQLTABLE also inherits and consider the selection criterion introduced by the execution user object.

    If the user makes a selection criterion, the system will translate to SQL language and, as a rule, I always added ultimately of the SQL statement in the judgment of SQLTABLE to construct the query to the database.

    If the SQL statement itself would contain clauses SQLTABLE the GROUP BY , to add to the selection criteria final SQL statement to build the query, the system would produce a syntax error.

    To avoid this situation and consider the object specified selection criteria and the system does not produce error construct the query, is strictly necessary to add to the WHERE clause (prior to GROUP clause BY ) of the SQL statement SQLTABLE, the following condition as it is exposed: AND $ 0 .

    With this instruction, the system will replace the $ 0 for the syntax of the selection criteria, which avoid which did not occur because the aforementioned syntax error to build the query.

    Furthermore, if the user in question is assigned a security role that pertenenezca the object, then the system the selection criteria for the susitutido $ 0 , will add the terms of the role for object.

  • Special Columns . The selection can be determined a special column (virtual, not physical table) to display it as an image (an icon). The name of this column must begin with "sqltable_icon" and its value must be the route a local image server, (preceded by 'http://localhost' if it can print the object. The alias for this column should be in the list of columns to display.

    'Http://localhost/coreutils/img/icon/image.gif' sqltable_icon_sample1 'Http://' sqltable_icon_sample2

    For printing (PDF) can be specified styles of columns with fields that are not displayed. These columns must be prefixed print_col_style_ .

    'Background-color = "rgb (242,242,242)" border-bottom = "0.5pt solid" border-top = "0.5pt solid" border-left = "0.5pt solid"' print_col_style_codart

In the special columns ("sqltable_icon") in the case of a local image server, this URL has to go preceded of 'http://localhost' otherwise the image will be displayed on screen but will not print in the paper.
When performing a select type "SELECT LENGTH (a) FROM table" and not get the column name as the name of this following:     
  • informix: (expression)
  • db2: 1
  • oracle: length (a)
Because it is possible to obtain a variable declaration error in the select, as a variable name can not be eg 1.

  • Format: SQLCOND_EXPR
cal_sqlstmt_backup Sql statement backup
Created by

  • Default: USER
Date created

  • Default: CURRENT
Modified by

  • Default: USER
Date updated Updated date

  • Default: CURRENT

2 Example

In this example, the occupation time of the employees is shown by a calendar.

For this example we will use the table employee_inout, which was created for the graph type SQL-JChart Gantt.

The data contained in this table are the following:

2.1 Definition of the object

SQL statement:



2.2 Variables

The columns are declared by which you can filter when accessing the calendar.

As in our case all occupancy times occur on the same day, it will be indicated that this day is by default in the filtering box.

2.3 Form Layout

Form editor:

A box of type SQL-CAL is created where the calendar can be displayed.

Parameters of the SQL-CAL box:

  1. It is indicated that only the Month view is shown.
  2. The Cache parameter is unchecked.
  3. In Title event you will have to use the column ' the_name'.
  4. In Start event will be ' time_in'.
  5. The SQL statement is declared.
  6. In Description event, ' the_description' will be set.
  7. In End event will be set ' time_out'.
  8. In all day will be set ' event_allday'.
  9. In class description will be set ' firstname'.
  10. In 'Background color' will be set ' event_color'.
  11. In Class color will be set ' color'.

SQL statement:

<select prefix='m_'>
        employee.firstname || ' ' || employee.lastname <alias name='the_name' />,
        0 <alias name='event_allday' />,
        employee.title <alias name='the_description' />,
        CASE WHEN employee_inout.employeeid = 1 THEN 'rgb(248,58,34)'
             WHEN employee_inout.employeeid = 2 THEN 'rgb(75,177,82)'
             WHEN employee_inout.employeeid = 3 THEN 'rgb(78,129,180)'
             WHEN employee_inout.employeeid = 4 THEN 'rgb(153,51,146)'
             WHEN employee_inout.employeeid = 5 THEN 'rgb(221,87,33)'
             WHEN employee_inout.employeeid = 6 THEN 'rgb(102,0,204)'
             WHEN employee_inout.employeeid = 7 THEN 'rgb(153,153,0)'
         ELSE 'rgb(0,0,0)' END  event_color
    <from table='employee_inout' >
        <join table='employee'>
            <on>employee_inout.employeeid = employee.employeeid</on>
        employee_inout.employeeid $employeeid  AND
        <date>employee_inout.time_in</date> >= $FECINI AND
        <date>employee_inout.time_out</date> &lt;=  $FECFIN 

2.4 Result

If you press any of the occupation times that are marked, a window with information will be displayed.