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:項目の値を別テーブルに転記する

Posted at

エディタ設定で転記元と転記先に同じ項目を作りキーとする

転記元 Title
転記先 Title

転記元のサーバースクリプトに記述

let data = {
  Keys: ["[キー項目]"],
  [転記先キー項目]: model.[転記元キー項目],
};
items.Upsert([転記先サイトID], JSON.stringify(data));
let data = {
  Keys: ["Title"],
  Title: model.Title,
};
items.Upsert(190, JSON.stringify(data));

転記元項目と転記先項目を指定する

Title Body Comment などは続けて指定

let data = {
  Keys: ["[キー項目]"],
  [転記先キー項目]: model.[転記元キー項目],
  [転記先項目]: model.[転記元項目],
  [転記先項目]: "[指定文字列]",
};
items.Upsert([転記先サイトID], JSON.stringify(data));
let data = {
  Keys: ["Title"],
  Title: model.Title,
  Body: "入力された内容はありません。"
};
items.Upsert(190, JSON.stringify(data));

Class Num Description などは{ }で囲んで指定

let data = {
  Keys: ["[キー項目]"],
  [転記先キー項目]: model.[転記元キー項目],
  [転記先項目]: model.[転記元項目],
  [転記先項目]: "[指定文字列]",
  ClassHash: {
      Class[転記先項目]: model.[転記元項目]
  },
  DescriptionHash: {
      Description[転記先項目]: model.[転記元項目]
  },
  NumHash: {
      Num[転記先項目]: model.[転記元項目]
  }
};
items.Upsert([転記先サイトID], JSON.stringify(data));
let data = {
  Keys: ["Title"],
  Title: model.Title,
  Body: "入力された内容はありません。",
  ClassHash: {
      ClassA: model.DescriptionA
  },
  DescriptionHash: {
      DescriptionA: model.DescriptionB
  },
  NumHash: {
      NumA: model.NumA
  }
};
items.Upsert(190, JSON.stringify(data));
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?