此方案介绍了如何使用示例脚本定期自动整合数据。
创建包含类似以下脚本的批处理 (.bat) 或 shell (.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 参数的值。此外,您可能要修改 dataimportfilename、dataexportfilename、importdatajobname、exportdatajobname、br_clear、br_calculatebalancesheet 和 br_allocatetarget 参数的值来满足需求
有关使用 Windows 任务计划程序计划脚本的信息,请参阅“自动执行脚本”。
@echo off
rem Sample Script to demonstrate daily data integration with
rem Cloud EPM 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%