0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【ローコードのSKE】更新日時の排他処理

Posted at

今回の記事は、SKEで排他処理機能のサンプルです。

共通設定

以下のテーブルを利用して、サンプルを作成します。

CREATE TABLE "テストテーブル"
(
  "主キー" integer NOT NULL,
  "名称" character varying(10),
  "作成者" character varying(20),
  "作成日時" timestamp without time zone,
  "最終更新者" character varying(20),
  "最終更新日時" timestamp without time zone,
  CONSTRAINT "テストテーブル_pkey" PRIMARY KEY ("主キー")
)

排他用項目は値の表示用フォーマットを行うと更新前後の比較はうまくできないため、表示用と排他用別々にする必要です。このため、クエリ項目を作成します。また、作成と更新の担当者と日時は、自動登録するようにモード別設定値を設定登録します。
image.png

クエリ
select *,最終更新日時 as v更新日時 from テストテーブル
作成者
{
	"add": function(){
        return session.get("USER_ID");
    },
	"copyAdd": function(){
        return session.get("USER_ID");
    }
}
作成日時
{
	"add": function(){
        return new Date();
    },
	"copyAdd": function(){
        return new Date();
    }
}
最終更新者
{
	"add": function(){
        return session.get("USER_ID");
    },
	"copyAdd": function(){
        return session.get("USER_ID");
    },
	"edit": function(){
        return session.get("USER_ID");
    }
}
最終更新日時
{
	"add": function(){
        return new Date();
    },
	"copyAdd": function(){
        return new Date();
    },
	"edit": function(){
        return new Date();
    }
}

入力ダイアログ

タイトル「最終更新日時」の項目は表示用で、ビュー項目とリンクします。タイトル「排他用」はhiddenにして、テーブル項目とリンクします。
image.png

効果

二つブラウザで同じデータを開きます。
image.png
右の画面は先に保存して、成功です。左の画面は後で保存して、排他失敗です。
image.png

まとめ

今回の記事のサンプルには、以下のアドオンを利用しました。

  • モード別項目設定値のアドオン
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?