このユースケースは、次のようなユーザーフローを記述しています: - 積載車用ナンバープレート
- ナンバープレートに応じた情報を表示
- ユーザー名のチケットを入力すると、配送されたビンが開き、注文が完了したことをマークします。
- 処理完了の表示画面
各ステップには、レポートビューとBellaDatiエンドポイント設定が定義されています。 Step 1 - 積載車用ナンバープレート
エンドポイント設定以下の構成でBellaDatiエンドポイントを作成します: - URL: checkRegistrationPlate/.*
設定: Code Block |
---|
| def registrations_ds_id = 263
//define ID of the data set with license plates
def registrationPlate = request.getPath().split("/").last()
//load the registration plate based on the entered value
def filter = isEqualFilter('L_REGISTRATION_PLATE', registrationPlate)
//define filter to be applied to the data set
def rows = readDataset(registrations_ds_id , 1, filter, com.belladati.common.sort.Sort.descending('row_uid'))
if (rows.size() == 0) {
return Response.ok('error;var1=wrong license plate',"text/plan").build()
//if the input value does not exist in the target data set, the specified error will be displayed
}
else {
return Response.ok('success;var2='+rows[0].getValues()['L_ORDER_ID']+'',"text/plain").build()
}
//if the value exists, the exists, the value from column L_ORDER_ID will be loaded to the variable var2 |
レポート構成カスタムコンテンツビューの定義 カスタムコンテンツビューに独自の設定を適用することができます。 要素 "value "は、ユーザーがビュー間を移動する際に値を読み込むために使用されます。 Code Block |
---|
<form>
<label for="var1">Registration plate:</label>
<input type="text" id="var1" name="var1" value={formula}res = @var1 as String
if (res == null){
return ""
}
else {
return res}{formula}><br><br>
</form> |
- カスタムフォームで使用するIDを持つレポート変数を作成します(例ではIDは「var1」。この構成では、値var2もあります。レポートビューにもそれを含めます.
- タブ設定にコンフィグを適用:
- ラベル設定:要件に応じたテキストを適用。これらのラベルは翻訳をサポートしています。
- 遷移先ビュー:カスタムコンテンツを含むビューを選択します。
- トランジションアクション HTTPメソッド。GET (パラメータはURLで設定されます)遷移アクションのURL:エンドポイントのURLを定義し、入力されたフォームの値をパラメータとして含める(例:コードvar1を持つレポート変数に$var1)
- 遷移アクションのURL:エンドポイントのURLを定義し、入力されたフォームの値をパラメータとして含める(例:コードvar1を持つレポート変数に$var1)
BellaDatiエンドポイントタイプの名前を使用する場合、エンドポイントは内部で呼び出され、ドメインとユーザーコンテキストが保持されます。 Image Modified Step 2 - 注文書が入った箱を開き、完了した注文書の情報を保存します
エンドポイント設定このエンドポイントは、注文のあるボックスを開き、完了に関する情報をデータセットに保存するために使用されます: 以下の構成でBellaDatiエンドポイントを作成します - URL: openBox
設定: Code Block |
---|
| registrations_ds_id = 263
request_config_id = 12
//ID of the request for publishing the data
def body = JSON.fromJSONString(body)
processed_order_ds_id = 264
def rows = readDataset(registrations_ds_id , 1, filter, com.belladati.common.sort.Sort.descending('row_uid'))
//first load the ID of the box to be opened
if (rows.size() == 0) {
return Response.ok('error;var1=wrong license plate',"text/plan").build()
}
else {
box='+rows[0].getValues()['L_BASKET']+'
//returns ID of the box to open
def data = [
L_ORDER : body.getString("order"),
L_USERNAME : body.getString("username")
L_DATETIME : currentLocalDateTime(),
L_BOX : box,
]
httpRequestAsync(request_config_id, null, box)
//sends command to close the box
storeDataset(processed_order_ds_id, [data])
//saved the information about completed order to the selected data set
return Response.ok('success').build()
} |
レポート構成このビューの内部では、ユーザーは開かれるボックスのIDを見ることができます。ユーザー名を入力すると、必要なリクエストが作成され、ボックスを開き、必要な情報をデータセットに保存するために使用されます。 カスタムコンテンツビューの定義 Code Block |
---|
<p>The selected order is available in the box {formula}@var2{formula}.</p>
<br>
<p>To open the box, please enter your username<p>
<br>
<form>
<label for="var1">Username:</label>
<input type="text" id="var3" name="var3" value={formula}res = @var3 as String
if (res == null){
return ""
}
else {
return res}{formula}><br><br>
</form> |
- タブの設定にコンフィグを適用します:
- ラベル設定:要件に応じたテキストを適用
- ビュー遷移:カスタムコンテンツを含むビューを選択する
- トランジションアクションのHTTPメソッド。POST (パラメータは Transition action HTTP content で設定)
- トランジションアクション URL:現在のエンドポイント設定からURLを適用
トランジションアクション HTTP コンテンツ Code Block |
---|
{"order" : "$var1", "username" : "$var3"} |
Step 3 - 概要最後の画面を表示するために、アプリの要件に応じたHTMLコンテンツを定義します。
レポート構成フロー終了後にユーザーを必要な画面にリダイレクトするための遷移先URLを定義します。
|