Árvore de páginas

Você está vendo a versão antiga da página. Ver a versão atual.

Comparar com o atual Ver Histórico da Página

« Anterior Versão 2 Atual »

Objective

The Quick Query Widget to be provided by Fluig will show the user data of indicators to be defined by the business areas for each of the ERPs. This widget will obtain information settings and business data through REST services to be implemented by each of the segments. For the Datasul  line, the REST service will be provided by the Datasul Framework, which in turn will search the settings and data of each of the indicators of a particular BO (Business Object Progress). These BOs must be implemented by the business areas responsible for the indicators.

The Quick Query Widget will be similar to the form in Figure 1 below.

 

You can access a prototype of the Quick Query widget screen through the link http://cassino:8180/integration/static/quicksearch/index.html?indicator=XXXX where XXXX must be the code of the registered indicator.


Figure 1

Indicator register

The indicators must be registered in GOLD under the option “ENG20065 – Quick Query Indicator Register” as shown in Figure 2.  

Figure 2

Once the indicator register routine is accessed, GOLD will open the initial screen, as shown in Figure 3.

.


Figure 3

Figure 3 shows the following actions:

  • Add: Enables the fields for the registration of a new indicator.
  • Modify: Allows the editing of a previously selected indicator.
  • Copy Version: Creates a replica of an  indicator of Innovation(79) to Supportability(69).
  • Delete: Removes the indicator.
  • Search: Performs the search for indicators.
  • First, Previous, Next, Last: Navigates between indicator records.
  • List: Opens a list screen with all indicators.
  • Export: Exports indicators in a fluig_indic.d file.

When choosing the option Add, GOLD will enable the fields for addition as shown in Figure 4.

Figure 4

As shown in Figure 4, the following fields are available for addition:

    • Sub Product: Indicates for which sub-product the indicator will be issued
    • Package: Indicates in which package the indicator will be released
    • Indicator: Sequential field which will identify the indicator. (Generated automatically)
    • BO Name: The name of the BO (ex: fluig/qs/user.p) that will be responsible for providing the settings information and the records for the indicator at hand must be entered. Further in this document we will see the details for implementation of this BO.
    • Description of indicator: Description of indicator that will be used to display it in the Fluig Quick Query widget.
    • Records per Page: Number of records that will be displayed in the Fluig Quick Query widget. The widget will perform the automatic page break according to the number of records to be displayed.

    • Has cache: indicates whether the browse will cache the data.

    • Time of data in memory: time, in seconds, that the browser will keep the cache.

    • Custom BO: If a customization is required, the custom BO name must be entered in this field. This BO must implement the same procedures as a default BO, as described below.
    • Autocomplete: checkbox indicating if autocomplete is enabled for this indicator.

For product 69, the current package is 60 – 12.1.1, which will already be recommended. The screen does not allow registration in a higher package.

If the user registers in a package below the official one, the screen will display a message informing that a higher package is available, and that this record must also be registered in the official package.

 

In the export option, the analyst must select for which subproduct and package the indicators should be exported, as shown in Figure 5.

After exporting, a fluig_indic.d file will be created, and a version of it copied to the TSF of the univdata folder ($/FOUNDATION/Fontes_Doc/Sustentacao/V11/V11/progress/src/univdata)

NOTE: The analyst is entirely responsible for this commit in the univdata folder 

 

Figure 5

 

Importing indicators

After the indicators are exported (fluig_indic.d), they must also be imported within Datasul. This procedure may be performed through the menu  (Foundation --> Basic (NPS) --> Tasks --> Importing Quick Queries).

When accessing this menu item, Datasul will open an import quick query screen, as shown in Figure 6.

Figure 6

In this screen, simply enter the location of the fluig_indic.d file and import it.

REST Service and BOs of Indicators

The Quick Query Widget will use a REST service available at Datasul to obtain the data required for the indicator. In turn, this REST service will obtain the information and data of each indicator through the indicator register and of a BO linked to the indicator.

To assist in the process of developing the BO, the include i_fluig_indicator.i was created, and will contain all default temp-tables to be used in the procedures. In order to use this include, simply import it in the beginning of the BO by inserting the following line:

{include/i_fluig_indicator.i}

Each BO of an indicator must implement the procedures described below:


Procedure Name: pi-obtem-campos-entidade-pai

Description: returns the list of columns of the parent entity to populate the upper left combobox of the widget (Figure 1).

Parameters:

  • user: user identifier for ERP (CHARACTER - INPUT type)
  • company: company identifier for ERP (CHARACTER - INPUT type)
  • ttParentFields: temp-table with the code/label list. Should contain only the items that the user is allowed to query (TEMP-TABLE – OUTPUT type)

       TEMP-TABLE fields:

  • ccode: CHARACTER - field code
  • clabel: CHARACTER - field label
Example of procedure: 

 

/* Procedure pi-obtem-campos-entidade-pai */

PROCEDURE pi-obtem-campos-entidade-pai:

                DEFINE INPUT PARAMETER user AS CHARACTER NO-UNDO.

                DEFINE INPUT PARAMETER company AS CHARACTER NO-UNDO.

                DEFINE OUTPUT PARAMETER TABLE FOR ttParentFields.

 

                CREATE ttParentFields.

                ASSIGN ttParentFields.ccode = "des_grp_usuar"

                              ttParentFields.clabel = "Grupo".

END PROCEDURE

 

Procedure Name: pi-obtem-colunas

Description: returns a Column Model list of the columns to be displayed in the quick query widget grid. This information will be used by the service to assemble the colModel, comprising the response JSON.

Parameters:

  • user: user identifier for ERP (CHARACTER - INPUT type)
  • company: company identifier for ERP (CHARACTER - INPUT type)
  • ttColumnModel: temp-table with the settings data for the Grid columns. Should contain only the columns that the user is allowed to query (TEMP-TABLE – OUTPUT type)

       TEMP-TABLE fields:

    • cname: CHARACTER - column name
    • cindex: CHARACTER - column index
    • clabel: CHARACTER - column name
    • lsortable: LOGICAL - indicates whether the user can sort by column
    • iwidth: INTEGER - column width, in pixels
    • calign: CHARACTER - column alignment (left, center or rigth)
    • csorttype: CHARACTER - sorting type (asc or dec)
    • cformatter: CHARACTER - formatter type, e.g.: date
    • cdatefmt: CHARACTER - date field format, e.g.: "d-M-Y"
    • lshowOnGrid:LOGICAL - indicates whether this field should be displayed in grid (default option = true)
    • cdefault-value: CHARACTER - default value for field.
For further informations, please refer to the colModel component, cformatter of jqGrid, at: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:colmodel_options

When opening a related action in a Progress program, include a column named rowid in the procedure return. 

Example of procedure:

/* Procedure pi-obtem-colunas */

PROCEDURE pi-obtem-colunas:

                DEFINE INPUT PARAMETER cusuario AS CHARACTER NO-UNDO.

                DEFINE INPUT PARAMETER cempresa AS CHARACTER NO-UNDO.

                DEFINE OUTPUT PARAMETER TABLE FOR ttColumnModel.

 

                CREATE ttColumnModel.

                ASSIGN ttColumnModel.cname = "cod_usuario"

                                  ttColumnModel.clabel = "Usuário"

                                  ttColumnModel.cindex = "cod_usuario"

                                  ttColumnModel.iwidth = 160

                                  ttColumnModel.lsortable = TRUE.

                CREATE ttColumnModel.

                ASSIGN ttColumnModel.cname = "nom_usuario"

                                  ttColumnModel.clabel = "Nome"

                                  ttColumnModel.cindex = "nom_usuario"

                                  ttColumnModel.iwidth = 250

                                  ttColumnModel.lsortable = TRUE.

                CREATE ttColumnModel.

                ASSIGN ttColumnModel.cname = "ind_tip_usuar"

                                  ttColumnModel.clabel = "Tipo"

                                  ttColumnModel.cindex = "ind_tip_usuar"

                                  ttColumnModel.iwidth = 160.

                CREATE ttColumnModel.              

                ASSIGN ttColumnModel.cname = "rowid"

                                  ttColumnModel.clabel = "Rowid"

                                  ttColumnModel.cindex = "rowid"

                                  ttColumnModel.iwidth = 100.

END PROCEDURE.


Procedure Name: pi-obtem-lista-selecao

Description: returns a list of items to comprise the selectionValues in the response JSON, which will be used to populate the upper right combobox of the widget (Figure 1).

Parameters:

  • user: user identifier for ERP (CHARACTER - INPUT type)
  • company: company identifier for ERP (CHARACTER - INPUT type)
  • ttSelectionValues: temp-table with the list of filters (selection values). Should contain only the items that the user is allowed to query (TEMP-TABLE – OUTPUT type)

       TEMP-TABLE fields:

    • ccode: CHARACTER - field code
    • clabel: CHARACTER - field label

Example of procedure:

/* Procedure pi-obtem-lista-selecao */

PROCEDURE pi-obtem-lista-selecao:

                DEFINE INPUT PARAMETER user AS CHARACTER NO-UNDO.

                DEFINE INPUT PARAMETER company AS CHARACTER NO-UNDO.

                DEFINE OUTPUT PARAMETER TABLE FOR ttSelectionValues.

 

                CREATE ttSelectionValues.

                ASSIGN ttSelectionValues.ccode = "AUSR"

                               ttSelectionValues.clabel = "Todos os usuários".

                CREATE ttSelectionValues.

                ASSIGN ttSelectionValues.ccode = "OADM"

                               ttSelectionValues.clabel = "Apenas Administradores".

                CREATE ttSelectionValues.

                ASSIGN ttSelectionValues.ccode = "OSUP"

                               ttSelectionValues.clabel = "Apenas Super".

                CREATE ttSelectionValues.

                ASSIGN ttSelectionValues.ccode = "OCOM"

                               ttSelectionValues.clabel = "Apenas Super".

                CREATE ttSelectionValues.

                ASSIGN ttSelectionValues.ccode = "OSPV"

                               ttSelectionValues.clabel = "Apenas Supervisores".

END PROCEDURE.


Procedure Name: pi-obtem-acoes-relacionadas

Description: returns a list of items to comprise relatedActions item in the response JSON, which will be used to populate the Related Actions combo (Figure 1).

Parameters:

  • user: user identifier for ERP (CHARACTER - INPUT type)
  • company: company identifier for ERP (CHARACTER - INPUT type)
  • ttRelatedActions: temp-table with the list of related indicators. Should contain only the items that the user is allowed to query (TEMP-TABLE – OUTPUT type)

       TEMP-TABLE fields:

    • clabel: CHARACTER - field label
    • ctype: CHARACTER - type of form to be opened. Possible values (md, flex or progress)
    • cmodule: CHARACTER - module to be opened
    • cprogram: CHARACTER - program to be opened
    • cviewtype: CHARACTER - type of screen format to be opened. Used for ctype=md or ctype=flex. Possible values (portlet,view and window)
    • crowid: CHARACTER - should be used to inform the field that will represent the rowid to related entities. 
If the application being opened is of Metadata type, the form must be registered in the application Menu.

With this information, the URLs will be assembled according to the formats below:

Progress:

http://10.80.5.40:8080/abl-external-call/execute?module=sec&program=sec000aa.w&user=framework

Metadata:

http://10.80.5.40:8080/josso/signon/externalUserAuthentication.do?josso_cmd=external-login&type=md&fromFluig=true&program=fnd.CRUDUsuarMestre&viewtype=view&userid=framework&password=ZnJhbWV3b3Jr=

Flex:

http://server:port/josso/signon/externalUserAuthentication.do?josso_cmd=external-login&type=frwk&module=fnd&fromFluig=true&program=datasul-calculatorportlet-flex&viewtype=portlet&userid=super&password=c3N6a0AxMjM=

Details of how to assemble the URLs, query the document:

Invoking Applications and Forms on Datasul through Fluig

Example of procedure:

/* Procedure pi-obtem-acoes-relacionadas */

PROCEDURE pi-obtem-acoes-relacionadas:

    DEFINE INPUT PARAMETER user AS CHARACTER NO-UNDO.

    DEFINE INPUT PARAMETER company AS CHARACTER NO-UNDO.

 

    DEFINE OUTPUT PARAMETER TABLE FOR ttRelatedActions.

 

    CREATE ttRelatedActions.

    ASSIGN ttRelatedActions.clabel = "Exemplo Progress"

           ttRelatedActions.ctype = "progress"

           ttRelatedActions.cmodule = "sec"

           ttRelatedActions.cprogram = "sec000aa.w".

    CREATE ttRelatedActions.

    ASSIGN ttRelatedActions.clabel = "Exemplo Metadados"

           ttRelatedActions.ctype = "md"

           ttRelatedActions.cprogram = "fnd.CRUDUsuarMestre"

           ttRelatedActions.cviewtype = "view".  

    CREATE ttRelatedActions.

    ASSIGN ttRelatedActions.clabel = "Exemplo Flex"

           ttRelatedActions.ctype = "flex"

           ttRelatedActions.cmodule = "fnd"

           ttRelatedActions.cprogram = "datasul-calculatorportlet-flex"

           ttRelatedActions.cviewtype = "portlet".

END PROCEDURE.

 

Procedure Name: pi-obtem-auto-complete

Description: performs a search in the data bank to return a list of items that will be used to populate the combobox of the auto-complete in the Quick Query widget.

Parameters:

  • user: user identifier for ERP (CHARACTER - INPUT type)
  • company: company identifier for ERP (CHARACTER - INPUT type)
  • csearchfield: Identifier of the master table column to be used in the search (CHARACTER - INPUT type).
  • csearchvalue: Text for search (CHARACTER - INPUT type).
  • cselection: widget selection field (CHARACTER – INPUT type).
  • clist: string containing a list of values found, where each item must be separated by |||| (four pipes) - (LONGCHAR – OUTPUT type).

          Example:  “Fin. Administrator|||| TOTVS Administrator”.

Example of procedure:

PROCEDURE pi-obtem-auto-complete:

    DEFINE INPUT PARAMETER user AS CHARACTER NO-UNDO.

    DEFINE INPUT PARAMETER company AS CHARACTER NO-UNDO.

    DEFINE INPUT PARAMETER csearchfield AS CHARACTER NO-UNDO.

    DEFINE INPUT PARAMETER csearchvalue AS CHARACTER NO-UNDO.

DEFINE INPUT PARAMETER cselection AS CHARACTER NO-UNDO.

    DEFINE OUTPUT PARAMETER clist AS LONGCHAR NO-UNDO.

 

    IF csearchvalue = ? THEN

        ASSIGN csearchvalue = "".

       

    DEFINE VARIABLE hQuery  AS HANDLE  NO-UNDO.

    DEFINE VARIABLE hbuffer AS HANDLE  NO-UNDO.

  

    CREATE BUFFER hbuffer FOR TABLE "EMSFND.GRP_USUAR".

   

    CREATE QUERY hQuery.

    hQuery:SET-BUFFERS(hbuffer).

    hQuery:QUERY-PREPARE("FOR EACH GRP_USUAR WHERE " + csearchfield +  " MATCHES '*" + csearchvalue + "*'").

    hQuery:QUERY-OPEN.

   

    HQUERY:GET-FIRST().

    REPEAT WHILE hbuffer:AVAIL: 

        IF  clist = '' THEN

            clist = hbuffer:BUFFER-FIELD(csearchfield):BUFFER-VALUE.

        ELSE

            clist = clist + '||||' + hbuffer:BUFFER-FIELD(csearchfield):BUFFER-VALUE.

 

        hQuery:GET-NEXT(). 

    END.

   

    hQuery:QUERY-CLOSE().

    DELETE OBJECT hQuery.

    DELETE OBJECT hbuffer.

   

END PROCEDURE.

 


Procedure Name: pi-obtem-dados

Description: performs a search in the data bank to return the page of records requested by the widget.

Parameters:

  • user: user identifier for ERP (CHARACTER - INPUT type)
  • company: company identifier for ERP (CHARACTER - INPUT type)
  • csortcol: name of column used for sorting records (CHARACTER - INPUT type).
  • csortorder: record sorting type: asc ou dec (CHARACTER - INPUT type).
  • csearchfield: column to apply filter (CHARACTER - INPUT type).
  • csearchvalue: value to apply filter (CHARACTER - INPUT type).
  • cselection: widget selection field (CHARACTER – INPUT type).
  • cfields: longchar that contains the columns of data that will be returned in ttData.(LONGCHAR – OUTPUT type)
  • ttData: Temp-table that contains the search return data. (TEMP-TABLE - OUTPUT type)

  TEMP-TABLE fields:

    • crecords: CHARACTER - valus to be presented in the quick query widget grid. These values must be separated by "||||" and must follow the sequence of the columns defined in the field cfields.

Example of procedure:

/* Procedure pi-obtem-dados */

PROCEDURE pi-obtem-dados:

    DEFINE INPUT PARAMETER user AS CHARACTER NO-UNDO.

    DEFINE INPUT PARAMETER company AS CHARACTER NO-UNDO.

    DEFINE INPUT PARAMETER csortcol AS CHARACTER NO-UNDO.   

    DEFINE INPUT PARAMETER csortorder AS CHARACTER NO-UNDO. 

    DEFINE INPUT PARAMETER csearchfield AS CHARACTER NO-UNDO.

    DEFINE INPUT PARAMETER csearchvalue AS CHARACTER NO-UNDO.

    DEFINE INPUT PARAMETER cselection AS CHARACTER NO-UNDO.

    DEFINE OUTPUT PARAMETER cfields AS LONGCHAR NO-UNDO.

    DEFINE OUTPUT PARAMETER TABLE FOR ttData.

 

    DEFINE VARIABLE hbusuario   AS HANDLE      NO-UNDO.

    DEFINE VARIABLE hbusuariogrpusuario AS HANDLE      NO-UNDO.

    DEFINE VARIABLE hbgrpusuario AS HANDLE      NO-UNDO.

       

    DEFINE VARIABLE hqusuario   AS HANDLE      NO-UNDO.

    DEFINE VARIABLE cwhere      AS CHARACTER   NO-UNDO INITIAL " FOR EACH usuar_mestre ".

    DEFINE VARIABLE cadvwhere   AS CHARACTER   NO-UNDO INITIAL " FOR EACH grp_usuar WHERE grp_usuar.des_grp_usuar MATCHES '*&1*', each usuar_grp_usuar WHERE usuar_grp_usuar.cod_grp_usuar = grp_usuar.cod_grp_usuar, each usuar_mestre WHERE usuar_mestre.cod_usuario = usuar_grp_usuar.cod_usuario ".

    DEFINE VARIABLE corderby    AS CHARACTER   NO-UNDO INITIAL " BY usuar_mestre.".

    DEFINE VARIABLE iaux        AS INTEGER     NO-UNDO.

    DEFINE VARIABLE ireposition AS INTEGER     NO-UNDO.

    DEFINE VARIABLE ladvanced   AS LOGICAL     NO-UNDO INITIAL FALSE.

 

 

   /***************************** DEFINING FIELDS ************************************/

    ASSIGN cfields = "cod_usuario" + "||||" + "nom_usuario" + "||||" + "ind_tip_usuar" + "||||" + "rowid".

 

    /* Sorting by column */

    ASSIGN corderby = corderby + csortcol.

 

    /* Checking the sorting type */

    CASE csortorder:

        WHEN "desc" THEN DO:

            corderby = corderby + " DESCENDING ".

        END.

    END CASE.

 

    /* Performing matches for auto-complete */

    IF csearchvalue <> "null" THEN DO:

        cwhere = SUBSTITUTE(cadvwhere,csearchvalue).

        ladvanced = TRUE.

    END.

   

    /* Assembling where by the combo column */

    CASE cselection:

        WHEN "OADM" THEN DO:

            cwhere = cwhere + " &1 usuar_mestre.ind_tip_usuar = 'Admin' ".

        END.

        WHEN "OSUP" THEN DO:

            cwhere = cwhere + " &1 usuar_mestre.ind_tip_usuar = 'Super' ".

        END.

        WHEN "OCOM" THEN DO:

            cwhere = cwhere + " &1 usuar_mestre.ind_tip_usuar = 'Comum' ".

        END.

        WHEN "OSPV" THEN DO:

            cwhere = cwhere + " &1 usuar_mestre.ind_tip_usuar = 'Supervisor' ".

        END.

    END CASE.

 

    IF ladvanced THEN DO:

        cwhere = SUBSTITUTE(cwhere," AND ").

    END.

    ELSE DO:

        cwhere = SUBSTITUTE(cwhere," WHERE ").

    END.

 

    /* Finishing assembling where */

    cwhere = cwhere + corderby.

  

    /* Assembling the query with dynamic buffer */

    CREATE BUFFER hbgrpusuario FOR TABLE "EMSFND.grp_usuar".

    CREATE BUFFER hbusuariogrpusuario FOR TABLE "EMSFND.usuar_grp_usuar".

    CREATE BUFFER hbusuario FOR TABLE "EMSFND.usuar_mestre".

 

    CREATE QUERY hqusuario.

     IF ladvanced THEN DO:

        hqusuario:SET-BUFFERS(hbgrpusuario,hbusuariogrpusuario, hbusuario).

     END.

     ELSE DO:

        hqusuario:SET-BUFFERS(hbusuario).

     END.

                 

    hqusuario:QUERY-PREPARE(cwhere).

    hqusuario:QUERY-OPEN().

   

    hqusuario:GET-FIRST().

 

    REPEAT WHILE hbusuario:AVAILABLE:

        CREATE ttData.

        ASSIGN ttData.crecords = hbusuario:BUFFER-FIELD("cod_usuario"):BUFFER-VALUE + "||||" +

                                 hbusuario:BUFFER-FIELD("nom_usuario"):BUFFER-VALUE + "||||" +

                                 hbusuario:BUFFER-FIELD("ind_tip_usuar"):BUFFER-VALUE + "||||" +

                                 STRING(hbusuario:ROWID).

        hqusuario:GET-NEXT().

    END.

   

    DELETE OBJECT hqusuario.

    DELETE OBJECT hbusuario.

END PROCEDURE.

 

Records Details

A program can be opened through the Related Actions combobox to display the details of a record selected on the grid. The program to be opened may be of Progress, Metadata or Flex type, defined according to the URL returned by the pi-obtem-acoes-relacionadas procedure. For Metadata forms of CRUDFreeform type, it is not necessary to make any changes in the form for it to be opened displaying the record selected in the widget grid. For Progress programs, Flex forms and Metadata of FreeForm type, some implementations are needed, as seen below:

FreeForm:

FreeForm forms that represent indicators should have a script on the creationComplete event of its main container (usually a canvas). This script should provide a code similar to the following:

DEFINE VARIABLE  mdProgram AS CHARACTER.
DEFINE VARIABLE ttPreSelRecord AS TEMP-TABLE.
mdProgram = GET-MD-PROGRAM().
/* Checks if the selected record sent by Fluig (if any)
   corresponds to the current form */
IF mdProgram = “crm1150.FFIndicadorX” THEN DO:
    ttPreSelRecord = GET-PRE-SEL-RECORD().
    /* Based on that, we have the record sent by Fluig available at
       temp-table ttPreSelRecord, where the field names correspond to the
       names defined in the colModel of the start service. The rest of the script 
should then prepare the presentation of the record.*/
    ...
    ...
END.

Flex:

For the forms implemented in Flex that represent indicators, developers should make changes to check, when initializing the form, the variables Application.application.parameters.mdProgram and Application.application.parameters.fluigSelRecord. If these variables have valid values that correspond to the form at hand, a detail screen with the available record must be displayed in fluigSelRecord.

Example:

var fluigSelRecord:Object = Application.application.parameters.fluigSelRecord;

Alert.show("num_pedido:" + fluigSelRecord.num_pedido);

Progress:

Thin Template:

Register program:

Definition of include ut-indicador-tabela.i:

Figure 3

 

Insert the code below in the procedure afterDisplayFields to reposition the record selected:

(adjust for the temp-table of the program)

Figure 4

 

In the BO of the program, include a procedure that receives the ROWID of the table, by parameter, to reposition the record:

Figure 5

 

Program, developed in Thin Template, opened with the record positioned:

Figure 6

 

SmartObjects:

Register program:

Definition of include ut-indicador-tabela.i:

Figure 7

 

Insert the code below in the local-initialize procedure for repositioning of the selected record, after the line “run pi-after-initialize.”:

IF r-ind-tabela <> ? THEN DO:
      RUN pi-reposiciona-query IN h_q01fn069 (INPUT r-ind-tabela).
      ASSIGN r-ind-tabela = ?.
END.

 

Figure 8

Foundation program, developed in SmartObject, open with the record positioned:

Figure 9

 

DWB:

Register program (base program):

Step 1:

Make sure that the variable v_rec_nome_tabela is declared in the program, as shown in the figure below.

 

 Figure 10

 

Step 2:

Use the initial include of the program on DWB, for example, the include “ix_p00_@&(program))”, to declare the include of the foundation and attribute the following value for the RECID type variable of the program:

 

 Figure 11

 

To recover the RECID of the desired table, you must run a comparison of the ROWID of the same table with the value stored in the variable r-ind-tabela, as shown in the example below, with the plano_cta_ctbl table:

 
{utp/indicador-tabela.i}
IF r-ind-tabela <> ? THEN DO:
    FIND FIRST plano_cta_ctbl NO-LOCK
        WHERE ROWID(plano_cta_ctbl) = r-ind-tabela NO-ERROR.
    IF AVAIL plano_cta_ctbl THEN DO:
        ASSIGN v_rec_plano_cta_ctbl = RECID(plano_cta_ctbl).
    END.
    ASSIGN r-ind-tabela = ?.
END.

 

 Figure 12

 

Step 3:

Since the main-block of the core program on DWB already features the search in the main table of the program by the RECID of the variable v_rec_nome_tabela, the developer will not have to perform the positioning.

 

 Figure 13

 

Figure 14

 

EMS5 program, developed in DWB, opened with the selected record:

Figure 15

 

Development tips:

Edit Document

Handling information in Quick Query

 

Initially, a quick query should bring the least information as possible, therefore the initial filter should be as restrictive as possible.

 

The first filter of the list will be considered as the initial Search and initial Filter, therefore the first search should be one that you will use the most and the first filter should be the most restrictive.

 

 

For greater security, the moment the search is made, some controls should be performed in relation to the parameters received. In addition, in order to facilitate debugging, log generation parameters should be included at the beginning of the event.

In short, the beginning of the PI “pi-get-data” must be as seen below:

 

PROCEDURE pi-obtem-dados:

    DEFINE INPUT  PARAMETER user      AS CHARACTER NO-UNDO.

    DEFINE INPUT  PARAMETER company      AS CHARACTER NO-UNDO.

    DEFINE INPUT  PARAMETER csortcol     AS CHARACTER NO-UNDO.

    DEFINE INPUT  PARAMETER csortorder   AS CHARACTER NO-UNDO.

    DEFINE INPUT  PARAMETER csearchfield AS CHARACTER NO-UNDO.

    DEFINE INPUT  PARAMETER csearchvalue AS CHARACTER NO-UNDO.

    DEFINE INPUT  PARAMETER cselection   AS CHARACTER NO-UNDO.

    DEFINE OUTPUT PARAMETER cfields      AS LONGCHAR  NO-UNDO.

    DEFINE OUTPUT PARAMETER TABLE FOR ttData.

 

    IF LOG-MANAGER:LOGGING-LEVEL > 2 THEN DO:

        LOG-MANAGER:WRITE-MESSAGE("Requisição QuickSearch recebida.",      "FLUIGQS") NO-ERROR.

        LOG-MANAGER:WRITE-MESSAGE("usuario     : " + STRING(user),      "FLUIGQS") NO-ERROR.

        LOG-MANAGER:WRITE-MESSAGE("empresa     : " + STRING(company),      "FLUIGQS") NO-ERROR.

        LOG-MANAGER:WRITE-MESSAGE("empresa     : " + STRING(company),      "FLUIGQS") NO-ERROR.

        LOG-MANAGER:WRITE-MESSAGE("csortorder  : " + STRING(csortorder),   "FLUIGQS") NO-ERROR.

        LOG-MANAGER:WRITE-MESSAGE("csearchfield: " + STRING(csearchfield), "FLUIGQS") NO-ERROR.

        LOG-MANAGER:WRITE-MESSAGE("csearchvalue: " + STRING(csearchvalue), "FLUIGQS") NO-ERROR.

        LOG-MANAGER:WRITE-MESSAGE("cselection  : " + STRING(cselection),   "FLUIGQS") NO-ERROR.

    END.

 

    run pi-get-padrao (input-output csearchfield, input <LISTA BUSCA>).

    /* <LISTA BUSCA> = List, separated by comma, of items created in the PI "pi-obtem-campos-entidade-pai"

             Example = "cod_tit_ap,cod_espec_docto,cdn_fornecedor,nom_abrev" */

 

    run pi-get-padrao (input-output cselection, input <LISTA FILTRO>).

    /* <LISTA FILTRO> = List, separated by comma, of items created in the PI "pi-obtem-lista-selecao"

              Example = "VENCH,ABERT,ATRAS,ATRAS30,ATRAS15" */

 

    if csearchvalue = ? or csearchvalue = "null" then

       assign csearchvalue = "".

 

At the end of the program, the PI “pi-get-padrao” must be added, as shown below:

 

PROCEDURE pi-get-padrao:

    def input-output param p_cod_index as char no-undo.

    def input        param p_lst_ops   as char no-undo.

 

    if lookup(p_cod_index, p_lst_ops) > 0 then return.

 

    assign p_cod_index = entry(1, p_lst_ops).

END PROCEDURE.

 

Auto-Complete

 

Even if the Search field has no “auto-complete”, this method will always be executed when the user types something in the search field. Therefore, the implementation of the “pi-obtem-auto-complete” method is mandatory.

For the fields that do not have “auto-complete”, the method must return an empty list.

 

 

  • Sem rótulos