Liquid UI - Documentation - 6.05 Sample Code

6.05 Sample Code


The following is a sample Offline code, which includes the following:

  • Creating a new transaction
  • Creating the database
  • Creating a screen
  • Creating a table
  • Trapping a UI event
  • Defining a toolbar pushbutton


The code for a sample script file 'XX01,js' is as follows. In this example, the comments are bolded for easier reading comprehension.

// Creating a new transaction
var strXX01TCode = 'xx01';
var objXX01 = new SR3TransactionObject(strXX01TCode); function OverrideFunctionF3Back(name,num,refresh) {
SR3StartTransaction(this.m_CurrentTransaction.m_strConnectionName,name,num,refresh) }
//Creating a new database 
objXX01DatabaseTable([
{fieldname:"z_xx01_no",columntitle:"Number",columnwidth:11,fieldtype:DBF_STRING,fieldlength:10,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC}, {fieldname:"z_xx01_itm",columntitle:"Item",columnwidth:5,fieldtype:DBF_STRING,fieldlength:5,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"z_xx01_desc",columntitle:"Description",columnwidth40,fieldtype:DBF_STRING,fieldlength:40,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"z_xx01_attr1",columntitle:"Attribute 1",columnwidth:8,fieldtype:DBF_STRING,fieldlength:8,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC},
{fieldname:"z_xx01_attr2",columntitle:"Attribute 2",columnwidth:8,fieldtype:DBF_STRING,fieldlength:8,keytype:DBT_NON_PRIMARY_KEY,columntype:CTRL_TABLE_STATIC}, ]);
// Creating a screen
objXX01.addScreen([
{type:SCR_CAPTION,label:"Transaction XX01 Example"},
{type:SCR_EDIT,label:"Number",position:{row:1,col:1,edcol:10,edlen:10},fieldname:"z_xx01_no",required:1},
{type:SCR_EDIT,label:"Item",position:{row:2,col:1,edcol:10,edlen:5},fieldname:"z_xx01_itm",required:1},
// Creating a table in the screen
{type:SCR_TABLE,caption:"XX01 Table",position:{top:4,left:1,bottom:10,right:30},linkedtableinfo:strXX01TCode,linkedshowinfo:"z_xx01_no,z_xx01_attr2",fieldname:"UNIQUE_TABLE_NAME",allowmultirowselection:1},
// Defining toolbar pushbutton
{type:SCR_ONAPPKEY,keyid:SHIFT + F5,keylabel:"@3D@CONFIGURE",keytooltip:KEYTOOLTIP_ONLINE,callback:function( )
{
this.m_CurrentTransaction.sendScreen(2);
} } ]);

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