Data Source

In option Data Source, you can import data to SGI as follows: via TOTVS | DbAccess (query), ADVPL (Function) or integration with SIGADW.

Procedures

To create a new data source:

1. Click New.

2. In Main folder, enter a name and a description for this data source.

3. In Configuration folder (Source field), enter how data will be imported to the system.

 

Select:

TOTVS | DbAccess:

In this case, the import will be performed through a query. To execute it, you must indicate how the connection will be performed:

 

Connect through an environment:

Enter the Environment to execute the connection.        

 

Connect through a connection:

Fill out fields:

 dbDataBase: Database

 Top Alias: Top Alias to be used

 dbServer: Name or IP address of Top Connect connect

 dbContype: Connection protocol

 

In Declarations folder, enter the query to be executed to import the data import.

The query must return as result set with the columns:

Indicator ID (ID)

Customer code (USERCOD)

Target Date (DATA)

Actual Value (VALOR)

Goal Value (META)

Preliminary Amount (PREVIA)

 

The query result must mandatorily follow this order. Column names must respect the names in parentheses above.

Example:

 

SELECT

'0000000003' AS ID,

'CODCLIENTE' AS USERCOD,

'20071201'   AS DATA,

'100000,333' AS VALOR,

'100000,000' AS META,

'100000,000' AS PREVIA

FROM

<Tabela>

GROUP BY DATA

 

 

When fields ID and USERCOD are filled out, the field USERID will prevail.

 

ADVPL:

In this case, the import will be performed through a function written in ADVPL. To execute it, you must configure the connection parameters.

Fill out fields:

Environment: for the connection.        

Server: Name or IP address of the server.

Port: Port of Protheus® Server

Company: Company number

Branch: Branch number

 

In Declarations folder, enter the name of ADVPL function to be used.

The ADVPL function must return a multidimensional array in the following order and structure:

{{ID, USERCOD, DATA, VALOR, META, PREVIA}, ...}\"

 

Values cannot contain the thousands separator.

The date must be in format yyyymmdd.

The field Preliminary is optional.

When fields ID and USERCOD are filled out, the field USERID will prevail.

 

Example:

user function aExemplo()

//Demonstrating only the need to use the Prepare Environment

'01' dbselectArea(SA1) dbgotop() ConOut(A1_NREDUZ)

return {{'0000000003', 'CODCLIENTE', '20071201', '100.333', '100.000',’’}}

SIGADW

Data can be imported through integration with SigaDW.

Before creating a data source to import data from SIGADW you must check whether there is a query in DW that returns a full date (YYYYMMDD) and numeric files to be imported.

1. In the Main folder, enter the data source name.
2. In Configuration folder, enter parameters for the import.
3. In Indicators folder, enter the indicator to be updated.
4. Import data source: