How to populate information when double click a table item

  • KM03609111
  • 18-Mar-2020
  • 31-Mar-2020

Summary

How to populate information when double click a table item

Question

There may be a need of have a table in one form and use one of its items to fill other information. In order to do that, the following example can be used as reference

Answer

For this example, the contract module will be use:

1. Add an array of structure field in the contract dbdict with the following information:

    name            type

   catalog          array

   catalog          structure

   catalogid        character

   catalogvalue   character

2. Go to form designer by typing fd in the Service Manager Command line

3. Find the form with name: contract.lease

4. Add a table object with two columns. Set the following properties:

    a. for the table object:

        property                            value

       Selection Field                   catalogid

       Default Button ID                6661

       Double Click Button ID        6661

       Double Click Field               catalogid

    b. for the first column:

        property                            value

       Input                                  catalog

       Field                                  catalogid

       Select Only                        checked

   c. for the second column:

        property                            value

       Input                                  catalog

       Field                                  catalogvalue

5. Save the form

6. Add one display options:

   a. Screen ID: contract.view

   b. Unique ID: contract.view_test

   c. GUI option: 6661

   d. Text Option: 6661

   e. Condition: true

    f. Bank: 1

    g. Action: save

    i. Default Label: Save

    j. Pre Rad Expressions: $indice=cursor.line(1)

    k.Post Javascript:

vars.$L_file.brief_description=vars.$L_file.catalogo[vars.$indice-1].catalogoid

7. Add a second display options:

   a. Screen ID: contract.view

   b. Unique ID: contract.view_test2

   c. GUI option: 666

   d. Text Option: 666

   e. Condition: true

    f. Bank: 1

    g. Action: save

    i. Default Label: Savetest

    j. Post Javascript:

vars.$L_file.catalogo[0].catalogoid=

"1"

vars.$L_file.catalogo[1].catalogoid=

"2"

vars.$L_file.catalogo[2].catalogoid=

"3"

vars.$L_file.catalogo[0].catalogovalor=

"a"

vars.$L_file.catalogo[1].catalogovalor=

"b"

vars.$L_file.catalogo[2].catalogovalor=

8. Test the result.

 a. Find the LEASETEST contract: go to System Navigator>Configuration Management>Contracts>Contracts

 b. The table added in the form should be displayed.

 c. Click more options>Savetest. The table will be filled with some data

 d. Double click one line. Notice that the brief description field will be filled with the column selected

"c"