Support > Repository > Screen function > [Application] Logical deletion
ja | en

If you enable logical deletion, the delete button will change to the flag set function of a specific item. Combined with implicit conditions, it behaves as if it were deleted by appearance. R7.2.1

We will prepare two accounts as shown in Fig. 1 and Fig. 2 here.

userGeneral userLogical delete only
managerOperation managerLogical deletion and physical deletion can be performed
Figure 1 General user
Figure 2 Operation manager

General user

Log on as a normal user.We will register 1 customer data.

Figure 3 Creating customer data

After registration, click "Delete" button.At this point, the delete button is designed to operate as a logical deletion, and by pressing the button the date and time is set in the "expiration date" item and it becomes the update operation.

Figure 4 Performing Logical Delete Function

We set an implicit condition so that only the blank (null) value is searched for the value of the "expiration date" item.As a result, logical deleted data is not searched.

Figure 5 Logically deleted data becomes invisible (setting of implicit condition)

Operation manager

Then log on as a business administrator.Since the implicit condition is set to be canceled, data can be retrieved.

Figure 6 Logically deleted data can also be retrieved

Open the details screen.You can see that the date and time of the logical deletion is set in the "expiration date" item.

Fig. 7 Confirmation of expiration date item
The name of the expiration date item is arbitrary, but please make the type "string type".The value to be saved is date time (character string that means).

Perform physical deletion

The operation manager can perform physical deletion.Since the normal deletion button is a logical deletion, new "delete physical" button is prepared.

Figure 8 Preparing Physical Delete Button

Deletion from the database is done by pressing the button.

Figure 9 Performing Physical Delete

In this example, we set the logical deletion function in the "customer" model.As shown in Figure 10, prepare the "expiration date" item.
(Item name and item ID are optional, but please prepare type as character string type.)

Figure 10 Prepare expiration date items in customer model
It can be used as "invalidity judgment" item of model reference.

The "expiration date" item prepared this time can also be used as invalidity judgment item of model reference.How to use invalidation is "choice model> Invalidate choicesPlease read.

Setting the expiration date item

This item is used as an implicit condition.Therefore, we will save it in the database.

Figure 11 Saving in the database

Also, it will be read only so that it can not be entered.(It can be hidden in production operation.)

Figure 12 Setting to read only

Sets the implicit condition.Let's rule "value is equal to" null ". However, we set the exclusion authorization at the same time.The authority name is "pdelete".(Described later)

As a result, "when valid IS NULL" is always appended to SQL where clause when retrieving data.

Figure 13 Setting Implicit Conditions

Enable logical deletion

Set "Screen> Other> Delete". Activate "Delete data as logical deletion".In addition, set items for logical delete judgment.This is the item prepared in Figure 10.

Figure 14 Enabling Logical Delete

Prepare Physical Delete button

On the screen shown in Fig. 14, prepare the physical deletion button as an original button.(FIG. 15)

Figure 15 Setting Physical Delete Button
item Description Input example
screen name "Detailed display screen" will be. Detailed display screen
indicate Enable it. indicate
Display condition If you have a task manager principal "manager", we will display the physical deletion button. HASPRINCIPAL("manager")
Button name Specify an arbitrary name. Physical delete
event name You need to send a Send event to the Physical Delete screen. Send
Action name Physical deletion screen is physicalDelete <model name>.(*1) physicalDeleteCustomer
1 Apply Camel notation.For example, if the model name is my_funny_valentine, it is physicalDeleteMyFunnyValentine.

Prepare Physical Deletion Authority

Prepare a new permission "pdelete".This is a fixed name.Japanese names are arbitrary, but here we will say "physical deletion".

Prepare a principal holding this permission.I distinguished it from general users, and prepared a business manager (manager) here.

Fig. 16 Authority setting
  • The accounts prepared in Figures 1 and 2 are set to have this principal.
  • In the implicit condition setting shown in Fig. 13, "pdelete" is set as an authority (permission) which is not applicable.
  • In the button addition setting shown in Fig. 15, it is set to display a button when this principal "manager" is held.

By default, the judgment item of logical deletion is stored (at the time of deletion) date time (character string indicating).If this item is null it is assumed that it is not deleted.

You can customize this rule.For example, set the rule "0: Normal, 1: Delete".

Setting Implicit Conditions

Let's set the setting in Fig. 13 equal to 0.

Figure 17 Setting Implicit Conditions

Script settings

Write a script that operates at the time of logical deletion.This specifies "Logical deletion" at the execution timing of "Screen> Script> Helper".

Figure 18 Script settings to operate when deleting logical

This time it will be the following code.

customer.valid = "1";

Requires detailed screen

When using this setting, it is necessary to prepare the detailed screen of the target model.

Unsupported function

  • CSV/Excel upload update is not supported.Deleting in upload update becomes "Physical deletion".
  • REST API is not supported.Currently only physical deletion.

Button arrangement

You can not control the display order of the buttons.The original button is always placed on the right side of the button display.