Author Topic: Variable based Function Calling  (Read 2175 times)

Benjamin Dasari

  • GuiXT Forum
  • Newbie
  • *
  • Posts: 95
    • View Profile
Variable based Function Calling
« on: August 17, 2017, 03:56:08 PM »
Purpose:
Variable based function calling can be used to change the function name at one place even though it is used at multiple places in a file.

In the below example, if we need to change the name of the function; even though the function is called thrice, we just need to change it at one place i.e., wherever we have initialized it.

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPLSMTR_NAVIGATION.E0100.sjs
----------------------------------------------------------------------------------------------------------------------------------------------
var myfunction = "variableFunction";

function variableFunction(param){
   onscreen 'SAPLSMTR_NAVIGATION.0100'
      enter("/n"+param.l_screen);
}

// User Interface
clearscreen();
pushbutton([1,4], "VA01", "?", {"size":[2,20], "process":eval(myfunction), "using":{"l_screen":"VA01"}});
pushbutton([4,4], "MM01", "?", {"size":[2,20], "process":eval(myfunction), "using":{"l_screen":"MM01"}});
pushbutton([7,4], "CS01", "?", {"size":[2,20], "process":eval(myfunction), "using":{"l_screen":"CS01"}});


See attachments for code samples!

« Last Edit: August 21, 2017, 01:09:45 PM by Benjamin Dasari »