Utilities

Cosmos Data

ArchitectureTop

Cosmos Data allows you to easily extract information from a database by graphically selecting the tables and columns to display and defining the selection conditions.

Cosmos Data is a graphical tool that shows the structure of tables and columns of a database defined in the CRF repository of the Cosmos project. The tables are shown following a tree structure according to the JOINs defined in the repository.

The end user begins by selecting columns from a table, and from there, can be linked to any of the related tables.

This utility is available as of Cosmos version 6.0.

ConfigurationTop

Cosmos Data uses two configuration files: cosmosdata.ini and configuration.ini.

Cosmosdata.ini

The cosmosdata.ini file is the Cosmos Project configuration file used by Cosmos Data. It stores the connection data to the database, the environment parameters such as the DBTEMP variable, and so on.

Configuration.ini

The configuration.ini file allows you to customize the information displayed to the end user of Cosmos Data.

Here you define the CRF repository you want to use, the name of the connection and the database that contains the data to display, the default directory where the query files will be stored, etc.

The name "configuration.ini" is the default value for this file, but Cosmos Data allows the use of a different configuration file and pass it as the execution parameter of the application "-config <configuration_file.ini>".

The configuration.ini file is divided into the following sections:

Section [General]

In this section you define the variables that indicate the name of the connection and the database that you want to use, the name of the repository and other parameters of internal operation of the application.

CONNECTION. This variable indicates the name of the database connection to use when execut-ing the data query process. The connection name must match a connection to a database defined in the cosmosdata.ini file.

DATABASE. Indicates the name of the database to be accessed when the data query process is executed.

REPOSITORY. Indicates the name of the tables repository CRF file to be used in the Cosmos Data application.

REPORTSPATH. Option variable that will indicate the default directory where the report files will be stored. These files are ASCII files with SRW extension where the name of the report, the name of the master table, the list of columns and joins, grouping columns, ordering, aggregate calculation and report conditions are defined.

BACKUPREPORT. Optional usage variable whose value is a Boolean (TRUE / FALSE, YES / NO) that indicates whether an automatic copy of the report file will be performed each time the [Save] button is pressed.

DEBUGMODE. Optional use variable whose value is a Boolean (TRUE / FALSE, YES / NO) that in-dicates whether all column information, joins, etc., of the report tables in the application type list controls will be displayed.

Section [Export]

This section will define the project modules that can be added externally to perform data processing tasks. See "External Export" below.

Section [Include Tables]

This section will specify the list of repository tables that will be visible from the application's visual environment. If no tables are included, all tables are displayed. One table per line should be indicated.

Section [Exclude Tables]

This section will list the repository tables that will not be visible from the application's visual environment. In the case that no excluded tables are indicated, all tables are displayed. One table per line should be indicated.

If values are indicated in both "Include Tables" and "Exclude Tables" the behavior is as follows: Only the tables defined in "Include Tables" other than "Exclude Tables" will be displayed.

Section [Include Columns]

In this section you will see the list of columns (table.column) that will be visible from the visual environment of the application. If no columns are indicated, all the columns in the visible tables are displayed. You should indicate one column per line.

Section [Exclude Columns]

This section will list the name of of columns (table.column) that will not be visible from the visual environment of the application. If no columns are indicated, all the columns in the visible tables are displayed. You should indicate one column per line.

If values are indicated in both "Include Columns" and "Exclude Columns" the behavior is as follows: Only columns defined in "Include Columns" other than "Exclude Columns" will be displayed.

Section [Rename Tables Labels]

This section will list the tables in the repository that you want displayed with a description different from the one in the repository.

It will also be possible to modify the label of a table from the application environment by right-clicking on the table name and choosing the "Edit Table Name" option.

Section [Rename Columns Labels]

In this section you will see the list of columns in the repository that you want displayed with a description different from the one in the repository.

It will also be possible to modify the label of a column from the application environment by right-clicking the column name and choosing the "Edit Column".

Section [Expressions]

This section should include non-existent columns in the repository tables and which are the result of expressions or formulas between the columns in the table.

It will also be possible to add an expression column from the application environment by right clicking on the table and choosing the option "Add Expression".

Running Cosmos DataTop

Cosmos Data is a Cosmos application, so you need a Cosmos runtime to run it.

Command line parameters

From another Cosmos application

The RunCmdExt command is an internal Cosmos command of the Form class that allows you to invoke from a form with a FormTable a command specified in the RUNCMDEXT variable.

This execution can be performed using a key combination defined in the Cosmos project.

For example, you can invoke the Cosmos Data application by passing the FormTable table name ($MASTERTABLE) as a parameter, without having to modify all the forms in the application, but only by defining the accelerator and the command line.

Creation of a reportTop

The steps for creating a report can be summarized in:

  1. From the "Selection" tab, selection of master table and selection of columns of the master table and its dependencies.
  2. From the tab "Conditions", define conditions that will be taken into account when the report is executed.
  3. From the "Groups" tab, select the columns by which you want to group.
  4. From the "Sorting" tab, select the columns for which you want to sort.
  5. From the "Aggregates" tab, select columns for which you want to perform a calculation on the set of values in the group..
  6. Save the report with the [Save] button or with the "Save" menu option in the "File" menu.

Cosmos Data main screen consists of five tabs: "Selection", "Conditions", "Groups", "Sorting" and "Aggregates", and a list control showing the summary of the list: Master table, selected columns, conditions , groups, sorting and aggregates.

Running a report from Cosmos DataTop

The result of the execution of a report can be displayed on screen or dump to a text file in UNL, CSV or Excel format.

If the report has not been saved or changes have been made that have not been archived, the file must be saved from the "Save" option in the "File" menu or the [Save] button before execution. If you want to change the name of the report file, you must execute the "Save As" option in the "File" menu.

For the execution of the report to be correct, Cosmos Data must have defined the name of the connection and the name of the database to be connected to extract the data. See the CONNECTION and DATABASE variables in the "General section" of the "configuration.ini" configuration file discussed earlier in this document.

The structure and name of the tables and the name and type of columns of the CRF repository used in the report must match those of the database from which the data is to be extracted.

Screen output

To execute and display the result of the execution of a report created in Cosmos Data, you must select the "Execute" option from the "File" menu or click on the [Execute] button.

The result of the report will appear on a separate screen, in list format.

If grouping columns are selected, the list will appear in tree format. It is possible to change the grouping columns in the result window by pressing the [Group] button, and dragging the columns from the list header to the grouping bar. From this grouping bar it is also possible to indicate aggregate columns. Pressing the [OK] button will recalculate the list and will be displayed in the display list.

File output

Cosmos Data allows storing the output of a report execution in a text file in UNL, CSV or Excel format.

The output in UNL format will create a text file in which you will write one line per record, and each field will be delimited by a pipe character "|".

The output in CSV format will create a text file in which one line will be written per record, and each field will be delimited by a semicolon character ";".

The output in Excel format will create an Excel XML file.

To select the output to file, you must execute the "Export To ..." option in the "File" menu and then choose the desired option (UNL, CSV or Excel). A selection window will appear where the directory and the name of the output file will be indicated.

External export

Cosmos Data allows the execution of Cosmos modules created by the programmer in order to customize the data output of an SRW report.

These modules must be programmed in Cosmos language, added to "cosmosdata.prj" and associated with the external export from the "configuration.ini" file in the [Export] section.

The external export modules must implement a Main method that will receive as parameter the path of the output file in the execution of an SRW report, and the description and SQL type of the columns of the same. In this way, these external modules programmed in Cosmos will be able to treat the information generated from Cosmos Data and display graphs, export data to other formats, etc.

Report files SRWTop

The report description files generated by Cosmos Data are stored in text format and with the SRW extension.

To use an existing report you must open it from the "Open" option in the "File" menu.

Cosmos Data manages the report description files from the application environment. It is recommended not to manually edit these files.

For further information see the PDF document