日次データ統合の自動化

このシナリオでは、データ統合を定期的に自動化するサンプル・スクリプトの使用方法を調べます。

データ統合関連のアクティビティを自動化する次のようなスクリプトが含まれるバッチ(.bat)またはシェル(.sh)ファイルを作成します。後述するWindows用のサンプル・スクリプトでは次のアクティビティを完了することで毎日のアプリケーション・データ統合を自動化します。

  • 環境にサインインします。
  • 存在する場合はDailyPlanDataを削除します。
  • DailyPlanDataをサービスにアップロードします。
  • プラン・タイプPlan1でビジネス・ルールClear Plan Targetsを実行します。
  • ジョブ名LoadDailyPlanを使用してデータをインポートします。
  • ビジネス・ルールBalance Sheet - Planを実行します。
  • ビジネス・ルールAllocate Plan Targetsを実行します。
  • 存在する場合はDailyTarget.zipを削除します。
  • ジョブ名ExportDailyTargetを使用してデータをDailyTarget.zipにエクスポートします。
  • DailyTarget.zipをサーバーにダウンロードしてタイムスタンプを付加します。
  • 環境からサインアウトします。

注:

このスクリプトを使用のために再利用する場合、必ずSET urlおよびSET userパラメータの値を変更してください。さらに、dataimportfilenamedataexportfilenameimportdatajobnameexportdatajobnamebr_clearbr_calculatebalancesheetおよびbr_allocatetargetパラメータの値を要件に合うように変更できます

Windowsタスク・スケジューラを使用してスクリプトをスケジュールする方法の詳細は、スクリプトの実行の自動化を参照してください。

@echo off

rem Sample Script to demonstrate daily data integration with 
rem EPM Cloud application.
rem This script uploads Plan data, clears target numbers,
rem runs a business rule to calculate balance sheet data, and 
rem recalculates target numbers on the Vision demo application

rem Please update these parameters
SET url=https://example.oraclecloud.com
SET user=serviceAdmin
SET dataimportfilename=DailyPlanData.csv
SET dataexportfilename=DailyTarget
SET importdatajobname=LoadDailyPlan
SET exportdatajobname=ExportDailyTarget
SET br_clear=Clear Plan Targets
SET br_calculatebalancesheet=Balance Sheet - Plan
SET br_allocatetarget=Allocate Plan Targets

SET password=%1

rem Executing EPM Automate commands

CD /D %~dp0
call epmautomate login %user% %password% %url%
IF %ERRORLEVEL% NEQ 0 goto :ERROR

for /f %%i in ('call epmautomate listfiles') do if %%i==%dataimportfilename% (call epmautomate deletefile %%i)
IF %ERRORLEVEL% NEQ 0 goto :ERROR

call epmautomate uploadfile %dataimportfilename%
IF %ERRORLEVEL% NEQ 0 goto :ERROR

call epmautomate runbusinessrule "%br_clear%"
IF %ERRORLEVEL% NEQ 0 goto :ERROR

call epmautomate importdata "%importdatajobname%"
IF %ERRORLEVEL% NEQ 0 goto :ERROR

call epmautomate runbusinessrule "%br_calculatebalancesheet%"
IF %ERRORLEVEL% NEQ 0 goto :ERROR

call epmautomate runbusinessrule "%br_allocatetarget%" "TargetVersion=Baseline"
IF %ERRORLEVEL% NEQ 0 goto :ERROR

for /f %%i in ('call epmautomate listfiles') do if %%i=="%dataexportfilename%.zip" (call epmautomate deletefile %%i)
IF %ERRORLEVEL% NEQ 0 goto :ERROR

call epmautomate exportdata %exportdatajobname% "%dataexportfilename%.zip"
IF %ERRORLEVEL% NEQ 0 goto :ERROR

call epmautomate downloadfile "%dataexportfilename%.zip"
IF %ERRORLEVEL% NEQ 0 goto :ERROR

rem Section to rename the file

Set Timestamp=%date:~4,2%_%date:~7,2%_%date:~10,4%_%time:~1,1%%time:~3,2%%
ren "%dataexportfilename%.zip" "%dataexportfilename%_%Timestamp%.zip"

call epmautomate logout
IF %ERRORLEVEL% NEQ 0 goto :ERROR

:EOF
echo Scheduled Task Completed successfully
exit /b %errorlevel%

:ERROR
echo Failed with error #%errorlevel%.
exit /b %errorlevel%