Support > Repository > Screen function > Screen transition (4) Transit from main model update screen to sub model update screen
ja | en

Transit from the main model update screen to the submodel update screen. Pass parameters at the same time.

It is an example that prepared a unique button in the customer model. This buttonOpen the update screen of your own submodel (customer submodel) directlyIt has become like.

Fig. 1 Open submodel update screen from customer model
The primary key of the customer model and customer submodel is identical.That is, there is a 1: 1 relationship.

When you click the "Sub model update screen" button, the screen changes to the customer sub model update screen.Since we used a submodel here, the data is the same.

Figure 2 Main model update screen, transition to sub model update screen

Unique button to prepare for customer model

On the customer model side, prepare a unique button to open the customer sub update screen.

Figure 7 Defining your own button
item Description Input example
screen name Specify which screen to add a button to.Here we will say "update screen". Update screen
indicate Enable it. (check)
Display condition When displaying buttons always, this column is blank.For conditions, see "Button display conditionPlease read.
Button name Specify an arbitrary name.It can also be expressed as an expression. Sub model update
event name Specify the event for the transitioned screen.In this time, since processing contents are described by script, we specify our own event. UpdateSubmodel
Action name When starting from the registration/update screen, the action name can not be described.Leave it blank.
Additional parameters Specify parameters to the screen to be transitioned.This time is omitted. (Described later)
Event names are case sensitive.


When starting from the registration/update screen, it is not possible to describe the transition destination screen ("Action name" in the table above).Therefore, screen transition control is done directly using a script.

Create a new file in the application wagbyapp/webapps/wagby/WEB-INF/script/model ID folder using a text editor.The file name should be as follows.

Update model ID _ event name. Js

The model ID uses Camel notation.In this example, it is as follows.

Camel notation: Capitalize the first letter.Remove the underscore included in the model name and capitalize the next letter.For example my_funny_valentine would be MyFunnyValentine.

The contents of the script are as follows.

function process() {
var ExcelFunction = Java.type("jp.jasminesoft.util.ExcelFunction");
var Jfcerror = Java.type("jp.jasminesoft.jfc.error.Jfcerror");
var Jfcwarn = Java.type("jp.jasminesoft.jfc.error.Jfcwarn");
var Jfcinfo = Java.type("jp.jasminesoft.jfc.error.Jfcinfo");
var stdout = java.lang.System.out;

var customerid = p.request.getParameter("customer_p$002fcustomerid");
return "redirect:/"+customerid;

Use return to specify the screen transition destination.For details, see "Logic logic> Screen transitionPlease read.

This script is not described directly from Wagby Designer.Therefore, include the declaration of the process function.


In the above script, Wagby reuses the parameter "customer_p $ 002fcustomerid" automatically generated for the update screen.

You can confirm the parameter name with the automatically generated JSP file, copy and paste it.

There is a file called "update +" model ID "+ P.jsp" in wagbyapp/webapps/project name/model ID/folder.If you open it with a text editor, you will find the following code.

<span id="content_customer_p$002fcustomerid" name="customer_p$002fcustomerid">

This id = "..." part becomes the parameter name.

It is possible to prepare "additional parameters" instead of automatically generated parameters.In the above example, if customerid = $ {customerid} is specified, the script can retrieve the value with p.request.getParameter ("customerid").

Reason for limiting to main model/submodel relation

In the example described on this page,Transition between main - submodels and same primary key data and restrictionsdoing. Otherwise, there is a problem that the lock of the transition source model is not released (when it moves to the transition destination).

Reason not describing transition destination

You can not directly describe the transition destination ("action name") when starting from the registration, copy registration, update screen.As introduced on this page, please use with script.

When you enter a transition destination ("action name"), the button is surrounded by form elements.However, since the registration/update screen was originally surrounded by form elements, form elements are included in form elements, so they will not work.

Other specifications/constraints

For other specifications and restrictions, "Screen transition (1) Transit from detail screen to registration screen> Specifications/ConstraintsPlease read.