Support > Repository > Screen function > [Advanced] Temporary storage of registered data
ja | en

If you use the temporary storage function of registered data, you can not view/update temporarily stored data from others. After that, you can share the data by switching to normal saving.

We will prepare two accounts here and explain.

accountPrincipalDescription
adminOperation managerSave data temporarily
user1General userPerform data search
  1. Log on with admin.A temporary save button is prepared on the screen of Figure 1.When newly registering, press the temporary save button to save the data.
    Fig.1 Press the "temporary save button"
  2. The item "Save status" is automatically set.Here it is "temporarily saved".
    Fig. 2 Temporary storage state
  3. The "save state" of the search condition searches for "normally saved" data, so no data can be found here.
    Figure 3 Searching for "normally saved" data
  4. When "save state" of the search condition is set to "temporarily save", data is found. However, in this caseOnly the data temporarily stored by you (logged-on user)Will be eligible.Temporarily stored data by other users will not be searched.
    Figure 4 Searching for "temporarily stored" data
    If you change the logon account to user1, you can see that it can not be searched.
    Figure 5 Not searched by another account
  5. Updates temporarily saved data.Now press the "Save" button.
    Fig. 6 Press "save" button
  6. The data will be "normally saved".
    Fig. 7 Normal preservation state
  7. Data will be found in the normal search process.
    Fig. 8 Retrieval of "normally saved" data (2)
    You can also search from another account.
    Figure 9 Search from account user1

This function is realized by combining multiple settings.
The sample described above is realized from the following two models.

Figure 10 Sample application model

Temporary storage flag model

The "temporary storage flag" model is a choice model showing the state.Here we prepare "temporary save" and "normal save" as shown in Figure 11.

Figure 11 Code that represents the preservation state

Temporary storage test model

Figure 12 shows the model used in the test.For the "Save status" item, refer to the temporary save flag model in Figure 11.

Figure 12 Definition of temporary storage test model

Prepare a "temporary storage" button

Open "Screen> Other> Java Source Code Settings".

Activate "Output class for customization".Prepare "temporary save" button on new registration screen and update screen respectively.

Figure 13 Preparing a temporary save button

The point is the extension specification [@ method = insert] and [@ method = update] next to the event name "TemplateSave".As a result, this button is (preserved) "save" "update"Same roleIt will become responsible.

Button name is optional.The event name should be "TemplateSave". Capital letters and lower case letters are distinguished.
The display position of the button is fixed.The original button you added will be placed on the right side.

"Save state" item

The "save state" item is prepared to control this function.Introduction Set the initial value.

Figure 14 Initial value of "Save status" item

The initial values ​​for registration and update are as follows.

IF(EXACT(EVENT(),"TemplateSave"),1,2)

EVENT functionYou can receive the original button event."1" is set when the temporary save button is pressed, and "2" is set otherwise.This corresponds to the code "temporary storage" and "normal storage" in Figure 11.

The initial value at the time of displaying the search screen is set to code "2" of "normal save".

2

In addition, this item is hidden when entering.

Figure 15 Setting hidden items
In actual operation, it is good to make it hidden when displayed.

Setting of "Author" item

The "creator" item is also prepared to control this function.Introduction Set the initial value.

By setting search values,Regardless of the value entered for the search condition of this item, the value specified here is usedIt will look like.

Figure 16 Searching for creator items Setting initial values
IF(${template_flag#id}==1,USERNAME(),null)

This expression is valid only when the ID of the "save state" which is the search condition item is 1, that is, when it is temporarily stored USERNAME function"Logon account" which is the value of the logon account.In the case of temporary storage, search conditions are automatically narrowed down by your logon account.

When SQL search to the database, the logon account name is given to the WHERE clause.

By this setting, the search condition input by the user is ignored in this item.Therefore, this item is hidden when searching.

Fig. 17 "Author" item is a hidden item when searching

Example of execution

Here is an example of preparing a registration confirmation screen.Click the "Save temporarily" button.

Figure 18 Temporary Save Button

Transit to confirmation screen.Click the "Register" button here.

Fig. 19 Transition to confirmation screen

You can see that the saved state is "temporarily saved".

Fig. 20 It is temporarily stored.

Definition method

Confirmation screen setting

Activate "Display confirmation screen" in "Screen> New registration".

Activate Fig. 21 "Display confirmation screen"

Prepare a hidden item "event"

Prepare a hidden item "event" to hold the event of the button.When going through the confirmation screen, the purpose is to record whether or not you pressed the "temporary save" button with the previous button.

Figure 22 Hidden item "Event"

This item is hidden when inputting and outputting.(FIGS. 23 and 24)

Figure 23 Input control> Setting of hidden items
Figure 24 Output control> Setting of hidden items

Set expression

If the event generated by pressing the button is either "temporary storage" ("TemplateSave") or "confirmation" ("Confirm"), hold it.Otherwise, use Me () to keep the currently saved value.

IF(
  OR(
    EXACT(EVENT(),"TemplateSave"),
    EXACT(EVENT(),"Confirm")
  ),
  EVENT(),
  Me()
)
Figure 25 Expression of hidden item event

Initial value of "Save status" item

Correct the equation in Figure 14 as follows.Make sure that the event generated by the press button is "TemplateSave" or the event held in the hidden item event is "TemplateSave".

IF(
  OR(
    EXACT(EVENT(),"TemplateSave"),
    EXACT(${event}, "TemplateSave")
  )
  ,1
  ,2
)
Fig. 26 Change the initial value of "Save status" item

When applying this setting to the model for which workflow is set, it is possible to operate such that the workflow is not started for temporarily saved data.(The workflow is not started unless you press the "application" button after registration.)

This temporary storage function involves processing to register in the database.(By incorporating the condition that it can not be browsed by others, temporary storage in operation is realized.)

for that reasonneed to checkItems that specifyMandatory even for temporary storage.Required checks apply NOT NULL constraint to the database to ensure logical consistency of data.