Liquid UI Forum

Using Your Liquid UI Products => WS aka Web Scripts (Attended RPA for SAP) => Topic started by: Benjamin Dasari on July 26, 2016, 01:49:32 PM

Title: Arrays using Key Value Pairs
Post by: Benjamin Dasari on July 26, 2016, 01:49:32 PM
Purpose:
Insert and retrieve values from an array using Key/Value pairs.

Liquid UI Code:

// SAPLSMTR_NAVIGATION.E0100.sjs

// Retrieve Material Descriptions
function showMatlDescs(){
   for(i=0;i<matDataArr.length;i++){
      matl_table.z_matl_desc[ i] = matDataArr[ i].value;
   }
   return;
}

// User Interface
clearscreen();
// Liquid UI table and columns
table([1,1],[20,50], {"name":"matl_table", "title":"Material Info", "rows":20});
column('Material', {"table":"T[Material Info]", "name":"z_matl", "readonly":true, "position":1, "size":15});
column('Description', {"table":"T[Material Info]", "name":"z_matl_desc", "position":2, "size":30});
pushbutton([21,1], "@01@Retrieve Material Descriptions", {"process":showMatlDescs});

// Sample Materials and Descriptions
var matDataArr = [];
for(i=1;i<=20;i++){
   matDataArr.push({key:'Material '+i+'',value:'Description '+i+''});
}

// Populating table with Material numbers
for(i=0;i<matDataArr.length;i++){
   matl_table.z_matl[ i] = matDataArr[ i].key;
}


See attachments for code samples!