Support > Repository > Screen function > Screen transition (4) Transit from detail screen to update screen (if there is no update data, automatically transition to registration screen)

Transit from detail screen to update model of arbitrary model. Pass parameters at the same time. If there is no more update data, we will automatically transition to the registration screen.

It is an example that prepared a unique button in the customer model. This buttonDirectly open the update screen of another model (support model)It has become like.

Figure 1 Opening update model of support model from customer model
Here, the relation of model reference is not defined for customer model and support model.However, it is assumed that there is a 1: 1 relationship between the primary key of the customer model and the primary key of the support model.

There is no support (tied to this customer) when you first press the Update button.At this time, it automatically transits from the update screen to the registration screen.In addition, some values ​​of the customer model are inherited in the registration screen.

Fig. 2 Transition to new screen when data is not registered

New registration of support data is completed.

Figure 3 New registration of support data is completed

Return to Figure 1.When you press the "support update" button again from the detail screen of the same customer data, since the data to be linked exists, the update screen opens.In other words, when data exists, update processing can be performed.

Fig. 4 Transition to update screen after data registration

The definition of "customer model" shown in Figure 1 is as follows.

Figure 5 Customer model

The definition of the corresponding "support model" is as follows.We do not define foreign key relationships with the customer model."Customer name" "Customer name Kana" "Customer e-mail" is not a reference, it is a character string type.

Figure 6 Definition of support model

Unique button to prepare for customer model

On the customer model side, prepare a unique button to open the support model 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 define "Detailed display screen". Detailed display screen
indicate Enable it. (check)
Display condition When displaying buttons always, this column is blank.Please read "Button display condition" for conditions.
Button name Specify an arbitrary name.It can also be expressed as an expression. Support update
event name Specify the event for the transitioned screen.The update event is "Update". Update
Action name Specify the screen to transition.The update screen is "update" + model name (camel notation). updateSupport
Additional parameters Specify parameters to the screen to be transitioned.Here we pass the data such as the primary key of the associated support model and the name of the customer model. (Described later)
Event names are case sensitive.Please input correctly.
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.

Additional parameters

You can pass the value directly to the update screen (or the new registration screen).

The format is "key = value".The key part is the item ID (of the transition destination model).
Using placeholders ($ {...}) in the value part,Transition sourceYou can pass in the value of the item.

To pass multiple parameters, separate them with &.

Additional parameters for realizing the example shown here are as follows.The left side of Equal is the item of support model.The right side of equal is item of customer model.

In this example, I am using the original button, not the update button which is usually prepared.This is to inherit the values ​​in the screen where buttons are placed to the model (registration/update screen) of the update processing.


The following can not be specified for the item name described in the additional parameter.

  • Repeat item
  • Repeating container item
  • A foreign key child model tied to this model

Setting support model

Activate "Transit to registration screen when update target data does not exist" in "Screen> Update> Update screen".

Fig. 8 Transition to registration screen when update target data does not exist

Customer name

In order to receive the initial value passed from the customer modelREQUESTApply the function.

Fig. 9 Acquiring the initial value of customer name from outside

Customer name

We also apply the REQUEST function.

Fig. 10 Acquire the initial value of customer name kana from the outside

Customer Email

We also apply the REQUEST function.

Fig. 11 Retrieve initial value of customer e-mail from outside
To reflect the value of a parameter different from the item name, describe as REQUEST ("parameter name").

"Transition of Screen (1) Transition from detail screen to registration screen> Please read the" Specifications/Restrictions ".