1
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?

More than 1 year has passed since last update.

プリザンターのサーバースクリプトにおいて、items.Getで200件以上のレコードを取得する方法

Last updated at Posted at 2023-01-18

はじめに

items.GetでOffsetを指定し、200件以上のレコードを取得する

ソースコード


//サイトIDを設定
const siteId = XXXX;
//Offsetを設定
const offSet = 200;
//JavaScriptオブジェクトとして、Offsetに200を設定
let data = {
    //Offsetは開始位置
    Offset : offSet
};
//サイトIDとJSONオブジェクトに変換したdataでレコード情報を格納
let results = items.Get(siteId, JSON.stringify(data));
//1レコード単位で処理を実行
for (let result of results) {
    //resultに設定されているレコードのレコードIDを表示
    context.Log(result.ResultId);
}

工夫

工夫というよりは今回の件で理解したことがありました。それは、Offsetというのは読み取りの開始位置だということ。さらにJSON.parse()は、JSON文字列を取得し、JavaScriptオブジェクトに変換するのに対して、JSON.stringify()は、JavaScriptオブジェクトを取得し、JSON文字列に変換するということ。これからはこの知識をもとにサーバースクリプト内でJSONと文字列の変換には困らなそうです。ちなみに、下記リンクを参照。
https://www.digitalocean.com/community/tutorials/js-json-parse-stringify-ja

1
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
1
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?