Liquid UI - Documentation - 1.02.03 Fast Download

1.02.03 Fast Download


When using Offline, there are often times when large data sets may need to be downloaded into the Offline database. These large data sets can cause a significant drop in performance. However, Offline enables the user to download large data sets in such a way that the performance is not significantly inhibited. During this process, users do not need to be connected to the backend server for Offline. However the data to be downloaded must exist in a text file locally on the offline server.

In the following example, we will demonstrate some example code that will download data to users' work stations. This sample code uses a generic data read function 'readCSVIntoTable' that will actually do the work of downloading the data into the work stations.

First, the data read function, which appears as shown in the following example:

readCSVIntoTable.call(this,"file.txt","iw2x",columninfo,10000,"identifier","column_number:lenght_of_strings:split_column_name1,split_column_name2",["column":"default_value"]);

The actual work is done by the following function:

var columninfo = ["g_iw2x_ref_date","g_iw2x_notf_no", "g_iw2x_sdesc", "g_iw2x_notf_type","g_iw2x_ord_no","g_iw2x_sub_area","g_iw2x_floc","g_iw2x_route_no","g_iw2x_tmap","g_iw2x_crew_type","g_iw2x_how_notified","g_iw2x_notif_dt","g_iw2x_planner","g_iw2x_resperson","g_iw2x_priority","g_iw2x_reqstdate","g_iw2x_reqenddt","g_iw2x_comp_date",g_iw2x_created_date","g_iw2x_change_date","g_iw2x_lngtxt_0","g_iw2x_lngtxt_1","g_iw2x_lngtxt_2","g_iw2x_lngtxt_3","g_iw2x_lngtxt_4","g_iw2x_houseno","g_iw2x_street","g_iw2x_city","g_iw2x_zip"];
readCSVIntoTable.call(this,"notification.txt","iw2x",columninfo,10000,"~","21:100:g_iw2x_lngtxt_0,g_iw2x_lngtxt_1,g_iw2x_lngtxt_2,g_iw2x_lngtxt_3,g_iw2x_lngtxt_4",["g_iw2x_no_off_stat:U"]);

The function demonstrated above utilizes the following parameters. Please note that the parameters are always lower-case when used in scripts:

  • notification.txt: The file from which the data is to be read.
  • iw2x: The table into which the data is to be read.
  • Columninfo: An array containing the columns that are to be sent to and then stored in the
    database.
  • 1000: How many rows to be committed at a single time. In this case, the number will be 1000
    rows at one time.
  • Delimiter: In the preceding example, it is '~'. This serves as the identifier in the text file used to differentiate the data.
  • 100: The number specifying the of characters into which the data from the 21st column will be
    split. In this example, it is 100.
  • Number_of_columns: The number of columns needed to hold the different data sent to the
    database. This number also identifies how many types of data are being sent to the database.
  • Length_of_columns_split: Sometimes large strings from the file would have to be split into smaller lengths because of a 255-character limit on edit fields.

    Note: This limitation no longer applies since the long text implementation in Offline.

  • Columns_split: The column names for the stable columns if they need to be split. In this case, it is the 21st column.
  • Column Names for Split: The column names for the data that will be split. In this example,
    these values are " g_iw2x_lngtxt_0,g_iw2x_lngtxt_1,g_iw2x_lngtxt_2,g_iw2x_lngtxt_3,g_iw2x_lngtxt_4".
  • Default Values: The default value that must be entered in a given column. In this example, the value is 'U' and will be entered into the column 'g_iw2x_no_off_stat'.
  • Column: User can place default values in any column they want while data is being stored in the database. This is useful when users want to create an extra field in offline, but that particular data does not yet exists since it is coming from the file being read.

The following example would read the file 'notification.txt' that contains the data to be downloaded.

readCSVIntoTable.call(this,"notification.txt","iw2x",columninfo,10000,"~","21:100:g_iw2x_lngtxt_0,g_iw2x_lngtxt_1,g_iw2x_lngtxt_2,g_iw2x_lngtxt_3,g_iw2x_lngtxt_4",["g_iw2x_no_off_stat:U"]);

Can't find the answers you're looking for?