Liquid UI - WS Reference Library

1.2.4 Indexing


As was discussed in the Fast Download section above, there are quite often times when users of Liquid UI Offline may be required to work with large data tables. These data tables can cause significant performance issues due to the large size of the data concerned. However, Offline enables users to reduce the problems associated with large data sets by using the indexing function. By indexing, users will not feel the effects of having large data sets in the system and the related operations will be performed at a faster pace.

Offline enables users to create indexes for each individual data table. This ensures that the database processing operations will be faster. The syntax for creating a database index is as follows:

createDatabaseIndex("data _table");

The createDatabaseIndex function is a generic API created in Offline. In order to use this API, the user is only required to call the API in order to create a relevant index for a data table. However, it is important to remember that when performing indexing, it is necessary to identify which columns in a given table will be indexed when the database table is created. It is also necessary to call the 'createDatabaseIndex( )' function defined above.

In the following example, we will first create a variable that refers to the specific SAP transaction as shown below:

var striw2xTCode = "iw2x";
var objiw2x = new SR3TransactionObject(striw2xTCode); //Creating Transaction Object

Once the variable has been created, the user will proceed to index given the data table. In the example shown below, we will be creating a new data table and indexing certain columns. The columns to be indexed are highlighted in green in the following script:

objiw2x.addDatabaseTable([
{fieldname:"g_iw2x_no_off_stat",index:1,columntitle:"Status",columnwidth:6, fieldlength:1,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_ref_date",columntitle:"Reference Date",columnwidth:14, fieldlength:10,fieldtype:DBF_STRING, keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_notf_no",columntitle:"Notif Num",columnwidth:12,fieldlength:11,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_sdesc",columntitle:"Description",columnwidth:0,fieldlength:40,fieldtype:DBF_STRING,
keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_notf_type",columntitle:"Notif Type",columnwidth:10,fieldlength:2,fieldtype:DBF_STRING, keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_ord_no",index:1,columntitle:"Order Num",columnwidth:0,fieldlength:8,fieldtype:DBF_STRING, keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_sub_area",columntitle:"Sub Area",columnwidth:0,fieldlength:5,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_floc",columntitle:"Func.Loc",columnwidth:0,fieldlength:8,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,
columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_route_no",columntitle:"Route Num",columnwidth:7,fieldlength:7,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_tmap",columntitle:"TMap",columnwidth:0,fieldlength:6,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_crew_type",columntitle:"Crew Type",columnwidth:10,fieldlength:1,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_crew_typedesc",columntitle:"Crew Type Desc",columnwidth:0,fieldlength:30,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_how_notified",columntitle:"How Notified",columnwidth:13,fieldlength:1,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_how_notifieddesc",columntitle:"How Notified Desc",columnwidth:0, fieldlength:30,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_notif_dt",columntitle:"Notify Date",columnwidth:11,fieldlength:10,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_planner",columntitle:"Planner",columnwidth:0,fieldlength:8,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_resperson",columntitle:"Res.Person",columnwidth:0, fieldlength:7,fieldtype:DBF_STRING, keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_priority",columntitle:"Priority",columnwidth:0,fieldlength:1,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_reqstdate",columntitle:"Req Start Date",columnwidth:0,fieldlength:10,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_reqenddt",columntitle:"Req End Date",columnwidth:0,fieldlength:10,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_comp_date",columntitle:"Complete Date",columnwidth:0,fieldlength:10,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_created_date",columntitle:"Created Date",columnwidth:0,fieldlength:10,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_change_date",columntitle:"Changed Date",columnwidth:0,fieldlength:10,fieldtype:DBF_STRING, keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_lngtxt_0",columntitle:"Lng.Txt-0",columnwidth:0,fieldlength:100,fieldtype:DBF_STRING, keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_lngtxt_1",columntitle:"Lng.Txt-1",columnwidth:0,fieldlength:100,fieldtype:DBF_STRING, keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_lngtxt_2",columntitle:"Lng.Txt-2",columnwidth:0,fieldlength:100,fieldtype:DBF_STRING, keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_lngtxt_3",columntitle:"Lng.Txt-3",columnwidth:0, fieldlength:100,fieldtype:DBF_STRING, keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_lngtxt_4",columntitle:"Lng.Txt-4",columnwidth:0,fieldlength:100,fieldtype:DBF_STRING, keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_rm1",columntitle:"RM1",columnwidth:0,fieldlength:3,fieldtype:DBF_STRING, keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_remark1desc",columntitle:"RM1 Desc",columnwidth:0,fieldlength:30,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_rm2",columntitle:"RM2",columnwidth:0,fieldlength:3,fieldtype:DBF_STRING, keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_remark2desc",columntitle:"RM2 Desc",columnwidth:0,fieldlength:30,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_rm3",columntitle:"RM3",columnwidth:0,fieldlength:3,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_remark3desc",columntitle:"RM3 Desc",columnwidth:0,fieldlength:30,fieldtype:DBF_STRING, keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_rm4",columntitle:"RM4",columnwidth:0,fieldlength:3,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_remark4desc",columntitle:"RM4 Desc",columnwidth:0,fieldlength:30,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_ntime",columntitle:"RM4 Desc",columnwidth:0,fieldlength:8,fieldtype:DBF_STRING, keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_houseno",columntitle:"HouseNo",columnwidth:10, fieldlength:10,fieldtype:DBF_STRING, keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_street",columntitle:"Street",columnwidth:20, fieldlength:60,fieldtype:DBF_STRING, keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_city",columntitle:"City",columnwidth:20,fieldlength:40,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},{fieldname:"g_iw2x_zip",columntitle:"Zip",columnwidth:10,fieldlength:10,fieldtype:DBF_STRING, keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
//{fieldname:"g_iw2x_state",columntitle:"State",columnwidth:5,fieldlength:3,fieldtype:DBF_STRING, keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"g_iw2x_lngtxtind",columntitle:"LngTxt Indicator",columnwidth:0,fieldlength:1,fieldtype:DBF_STRING,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC} ]);