オンデマンド・ルール(ODR)を使用すると、連結または変換プロセスの外部で計算を実行できます。これは、ビジネス要件に連結合計が必要ない状況で役に立ちます。また、オンデマンド・ルールは非常に効率的であり、迅速な計算ニーズに大変役立ちます。次の例は、オンデマンド・ルールを使用してGroovyスクリプト・ルールを記述する方法を示しています。
アプローチ1 - EPM Cloudベースの名前付き接続の使用
EPM Cloudベースの新しい接続を作成します。
/HyperionPlanningで終わるURLを指定します。
サービス管理者資格証明を指定します。
ドメイン名を指定します。
「検証」をクリックして接続を検証します。
「保存して閉じる」をクリックします。

Groovyスクリプトの例1

/*RTPS: {Scenario} {Years} {Period} {Entity}*/
String sScenario = rtps.Scenario.toString()
String sYears = rtps.Years.toString()
String sPeriod = rtps.Period.toString()
String sEntity = rtps.Entity.toString()
HttpResponse<String> jsonResponse = operation.application.getConnection("Consolidation Application").post("/rest/v3/applications/<AppName>/jobs")
.header("Content-Type", "application/json")
.body(json(["jobType" : "Rules", "jobName" : "Translate",
"parameters":
[
"Currency":"USD_Reporting",
"Scenario":"${sScenario}",
"Entity":"${sEntity}",
"Year":"${sYears}",
"Period":"${sPeriod}"
]
])).asString()
アプローチ2 - 他のWebサービス・プロバイダの名前付き接続の使用
他のWebサービス・プロバイダ・ベースの新しい接続を作成します。
/HyperionPlanning/rest/v3/applications/<AppName>/jobsの完全なURLを指定します。
Groovyルールの実行に使用するユーザー資格証明を指定します。
「保存して閉じる」をクリックします。

Groovyスクリプトの例2

/*RTPS: {Scenario} {Years} {Period} {Entity}*/
String sScenario = rtps.Scenario.toString()
String sYears = rtps.Years.toString()
String sPeriod = rtps.Period.toString()
String sEntity = rtps.Entity.toString()
HttpResponse<String> jsonResponse = operation.application.getConnection("Jobs").post()
.header("Content-Type", "application/json")
.body(json(["jobType" : "Rules", "jobName" : "Translate",
"parameters":
[
"Currency":"USD_Reporting",
"Scenario":"${sScenario}",
"Entity":"${sEntity}",
"Year":"${sYears}",
"Period":"${sPeriod}"
]
])).asString()
前述のいずれかのアプローチを使用して接続を作成した後は、ルール・カードまたはジョブから、あるいはEPM自動化を使用して、Groovyベースのルールを実行できます。