Creating a temp-table

Javra IDE uses temp-table through dataset. To create workable temp table program from Javra IDE following steps should be followed.

Step 1 – Create temp-table record in Repository

Step 2 – Create Program and associate query for temp table.

Step 3 – Create Event to fill the temp table.

To understand these steps, Let us go through the above steps in details

Step 1 - Create temp-table record in Repository

  • To create temp table in repository, go to X/E-Files->X/E Repository->X/E Repository
  • Make the changes in the tabs Files, Fields and Default Labels, based on the table below as per your requirement.
Tab Field Description
Files File Name of the files
Temp Table+ Check to identify file as temp table
Fields Widget name Name of the field
Format Format for field
Index Optional: States that field is index.
Primary Index Optional: States that field is primary index.
Data Type Data type for the field
Enable new Optional: Enable field on new mode
Enable update Optional: Enable field on update mode
Skip Copy Value of field will not be copied in copy mode.

Follow the below figure for representing the changes in File and Fields tab respectively.

Changes in File tab
Figure: Changes in File tab
Changes in Fields tab
Figure: Changes in Fields tab

Step 2 – Create a Program and associate query for temp table

  • In the Composer, Create a new program
  • Add the fields that we recently created in step 1 by clicking the Insert fields from database button
  • Select the field/Widget for which you desire to add Query. In the right panel > tab Query observe the following steps
    • Open a new Event property page by clicking the New button.
    • Query should be the name of dataset defined in source code.
    • Check main query
    • Check remote query – It indicates that the query is for temp table
    • File in query is the temp-table from repository.
    • Query clause should be blank.
    • Save the above changes

Follow the below figure for representing the changes in Query tab.

Changes in Query tab
Figure: Changes in Query tab

Step 3 – Create event to fill the temp table

Select the field/Widget for which you desire to add Event In the right panel Event tab observe the following steps

  • Open a new Event property page by clicking the New button
  • Create ds-fill event to fill dataset.
  • Add a unique Sequence number
  • Add a procedure name
  • Write logic to fill dataset in the editor and save it with a ‘.p’ extension
  • Save this ‘.p’ file name in Run
  • Save the above changes

Note: The logical ‘.p’ file must contain the specified procedure in it and must be placed in the directory inside the propath.

Follow the below figure which represents the changes to be made in Events tab

Changes in Events tab
Figure: Changes in Events tab

A sample of ‘.p’ procedure code written in Editor

{x/xxxxlparamds.i}

def temp-table tt-xuser serialize-name 'xuserremote' like xuser.

def temp-table tt-xugroup serialize-name 'gpremote' like xugroup.

def dataset ds-xuser serialize-name 'dsetusers'

for tt-xuser, tt-xugroup

data-relation dr1 for tt-xuser, tt-xugroup relation-fields(xusec,xusec) nested.

procedure p-fillds :

for each xuser no-lock:

create tt-xuser.

buffer-copy xuser to tt-xuser.

release tt-xuser.

for each xugroup where xugroup.xusec = xuser.xusec no-lock:

create tt-xugroup.

buffer-copy xugroup to tt-xugroup.

release tt-xugroup.

end.

end.

dataset ds-xuser:write-json ('longchar', p-dataset).

end procedure.

results matching ""

    No results matching ""