Support > Repository > Business logic > Using the Wagby function
ja | en

Functions provided by Wagby can also be used in code.

manyfunctionCan be used by giving the prefix "ExcelFunction."

customer.autoid = ExcelFunction.NUMTOJTEXT(1234, 1, 0);

The following functions are not available inside the script.

Similar things can be written in JavaScript programming.An example of the SUM function is shown here.

Please use "alternative notation" for the following function.
("P" is available as an implicit object in the script.)

Classification Function name Alternative notation Note
Numerical value RAND() JFCUtils .__ rand ("item name", p) (*1)
Numerical value RANDBETWEEN (start, end) JFCUtils .__ randbetween ("item name", p, start, end) (*1)
String RANDSTR (number of digits) JFCUtils .__ randstr ("item name", p, number of digits) (*1)
Date Time TODAY() p.request.getAttribute("__jfc_V_TODAY") -
Date Time NOW() p.request.getAttribute("__jfc_V_NOW") -
Date Time WORKDAY (start date, number of days) HolidayManager.getInstance (). GetEigyoDayAsSQLDate (start date, number of days) (*2)
Date Time NETWORKDAYS (start date, end date) HolidayManager.getInstance (). GetRestDay (start date, end date) (*2)
Authority HASMODELPERMISSION (argument string) JFCUtils.isValidPermission (p.user, argument string) (*1)
Authority HASPRINCIPAL (argument character string) JFCUtils.hasPrincipal (p.user, argument string) (*1)
account USERNAME() ((p.user!=null)?p.user.getUsername():"") -
account USERINFO (argument string) JFCUtils.getJuserAttribute (p, argument string) (*1)
account JGROUPID() JFCUtils.getJgroupid(p.user) (*1)
Screen control BROWSERTYPE() p.request.getAttribute("__jfc_browser_type") -
Screen control EVENT() JFCUtils.getEvent(p) (*1)
Screen control RESULTSIZE() JFCUtils.getResultSize(p) (*1)
Screen control SCREENID() p.request.getAttribute("__jfc_screen_id") -
Screen control WIZARDPAGE() JFCUtils.getWizardPage(p) (*1)
Internationalization LOCALE() JFCUtils.getLocale(p) (*1)
resource MESSAGE() JFCUtils.Message(p, "M0001")
JFCUtils.Message(p, "M0002", "hello")
(*1)
resource ERRORMESSAGE() JFCUtils.ErrorMessage(p, "E0001")
JFCUtils.ErrorMessage(p, "E0002", "hi")
(*1)
Workflow FLOWSTATUS ("model name", primary key) JfcworkstateServiceImpl.PARTICIPANTNODENAME (p, "model name", primary key) (*3)
Workflow WF_CURRENT_USERID ("model name", primary key) JfcworkstateServiceImpl.WFCURRENTUSERID (p, "model name", primary key) (*3)
Workflow WF_NEXT_USERID ("model name", primary key) JfcworkstateServiceImpl.WFNEXTUSERID (p, "model name", primary key) (*3)
Workflow WF_USERID() Model name (Camel notation) Helper.wf_nextuserid (p, "Model name", store model) (*4)
Workflow WF_CURRENT_GROUPID ("model name", primary key) JfcworkstateServiceImpl.WFCURRENTGROUPID (p, "model name", primary key) (*3)
Workflow WF_NEXT_GROUPID ("model name", primary key) JfcworkstateServiceImpl.WFNEXTGROUPID (p, "model name", primary key) (*3)
Workflow WF_GROUPID() Model name (Camel notation) Helper.wf_nextgroupid (p, "Model name", store model) (*4)
Workflow WF_IS_ADMITUSER() Model name (Camel notation) Helper.wf_isadmituser (p, "Model name", store model) (*4)
External cooperation REQUEST() p.request -
External cooperation SESSION() p.request.getSession() (*5)
1. When using Wagby up to R7.11.1, please declare a JavaClass type variable at the beginning of the script.Var JFCUtils = Java.type ("jp.jasminesoft.jfc.JFCUtils");It is unnecessary in Wagby after R7.11.2.(This line is included by default.)
2. When using Wagby up to R7.11.1, please declare a JavaClass type variable at the beginning of the script.Var HolidayManager = Java.type ("jp.jasminesoft.util.HolidayManager");It is unnecessary in Wagby after R7.11.2.(This line is included by default.)
3. Declare a JavaClass type variable at the beginning of the script.Var JFCUtils = Java.type ("jp.jasminesoft.wagby.app.jfcworkstate.JfcworkstateServiceImple");If you changed the package name, please read "jp.jasminesoft.wagby" properly.
4. Declare a JavaClass type variable at the beginning of the script.Var JFCUtils = Java.type ("jp.jasminesoft.wagby.app. <Model ID>. <Model ID> Helper");If you changed the package name, please read "jp.jasminesoft.wagby" properly.
5. SESSION () points to the HttpSession class.It is not a Hibernate Session.

An example

Depending on the screen to be called, processing is skipped

var screen_id = p.request.getAttribute("__jfc_screen_id");
if (screen_id != null && screen_id == "XXX") { /* 画面名を指定する */
    return;
}
... 処理の本体 ...
For details of the screen nameSCREENID functionPlease read the explanation.