Support > Repository > Screen function > Perform model operation with unique button on registration / update screen

I will explain an example of adding a repeating container by pushing the original button prepared on the registration/update screen.

This is an example of placing the button "Add 10 negotiation histories" on the new registration screen.

Figure 1 "Add 10 negotiation history" button is prepared

By pressing this button, 10 "business talking history" (repeating container) will be added.

Figure 2 Example of button press

Prepare buttons in "Screen> Other> Java source code setting" column.

Button name is optional.The event name is "Add 10 Reports".

Figure 3 Preparing the original button

This time we prepared a script for "Helper> Calculation".This script is called on the registration and maintenance screen as necessary.(Includes addition of repeating containers, screen redrawing processing etc).)

In the script, it judges whether or not this button is pushed and adds a container repeatedly when it meets the condition.

Figure 4 Helper> Create calculation script
var JFCUtils = Java.type("jp.jasminesoft.jfc.JFCUtils"); 

/* 顧客登録画面でのみ動作する。 */
if ("insertCustomer" != p.request.getAttribute("__jfc_screen_id")) {

if ("Add10Reports" != JFCUtils.getEvent(p)) {

var helper = p.appctx.getBean("CustomerHelper");
for (var i = 0; i < 10; i++) {
    /* 商談履歴の最後尾に1レコード追加。*/
    helper.addReport(customer, -1, true, p, errorManager);    
  • The value stored in the p.request object with the key name __jfc_screen_id,SCREENIDIt is the return value of the function.Here, it is used to judge the screen to be processed.
  • JFCUtils.getEvent (p)EVENTIt is the return value of the function.You can determine the event name of the original button.
  • To add a repeating container, you can use the method add <repeat container name> provided in the helper class of the same model.The first argument is the target store model.It can be used as an implicit object in a script.The second argument points to the insertion position.If the third argument is true, it means "add".If the second argument is -1 and the third argument is true add it to the end.For details, see the method of the auto-generated helper class.(The generated code is stored under the wagbydesigner/webapps/wagbydesigner/WEB - INF/env/work/srcgen folder.)
  • For implicit object p and errorManager, please read "Business Logic> Details of Generated Script File> Variables Available".
A helper calculation script is called when there is one or more items with a formula in the same model.Since it may be a dummy item, please prepare items with calculation formulas.(Example: A hidden item and a character string item not to be stored in the database, describe "dummy" in the calculation formula.)