0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Pleasanter選択項目によりルックアップ転記元を変更する

0
Posted at

基本環境

Pleasanter 1.5.2.0

やりたいこと

スクリーンショット 2026-06-04 164639.png

Aテーブルで経費種類をA,B,Cから選択し、ルックアップでお客を選択すると、Bマスターテーブルでそれぞれのお客に登録された経費A、経費B、経費Cを転記する
スクリーンショット 2026-06-04 160443.png

Aテーブルにルックアップ登録

テーブルの管理>エディタ>お客(ClassA)

[
    {
        "SiteId": BマスターテーブルのサイトID,
        "SearchFormat": "[Title] - 経費A:[NumA] - 経費B:[NumB] - 経費C:[NumC]",
        "View": {
            "ColumnSorterHash": {
                "Name": "asc"
            }
        },
        "Lookups": [
           {
                "From": "Title",
                "To": "ClassA"
            },
            {
                "From": "NumA",
                "To": "NumA"
            },
            {
                "From": "ResultID", //あるいはIssueID
                "To": "NumB"
            }
        ],
    }
]

「ドロップダウンリスト」を選択
検索機能を使うに「✓」

新規入力>「お客」ドロップダウンリストをクリックすると、
スクリーンショット 2026-06-04 162227.png
「経費A」→「経費」
「レコードID」→「お客ID」
へ転記される
スクリーンショット 2026-06-04 164810.png

「経費種類」でスイッチング

「経費種類」Aを選択し「お客」八百屋さんを選択した場合、「経費」に2000円
「経費種類」Bを選択し「お客」八百屋さんを選択した場合、「経費」に1500円
「経費種類」Cを選択し「お客」八百屋さんを選択した場合、「経費」に500円
とスイッチングするコードをサーバースクリプトへ記載

Aテーブルのサーバースクリプト

const linkId = model.NumB; //マスターテーブルのレコードIDを取得
const selected = model.ClassA; // 経費種類の値を取得

// 経費の種類で転記元を切り替え
const results = items.Get(linkId);
if (selected === 'A') {
    assembleFee = results[0].NumA;
} else if (selected === 'B') {
    assembleFee = results[0].NumB;
} else if (selected === 'C') {
    assembleFee = results[0].NumC;
}

model.NumA = assembleFee; // 「経費」へ値を入力

「条件」:更新前

結果

経費種類A
スクリーンショット 2026-06-04 165431.png
経費種類B
スクリーンショット 2026-06-04 165440.png

経費種類C
スクリーンショット 2026-06-04 165450.png

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?