In questo scenario si esamina l'uso di uno script di esempio per automatizzare l'integrazione dei dati su base regolare.
Creare un file batch (.bat) o shell (.sh) contenente uno script simile a quello riportato di seguito per rendere automatiche le attività relative all'integrazione dei dati. Lo script di esempio di Windows riportato di seguito automatizza l'integrazione dei dati dell'applicazione mediante il completamento delle attività indicate.
DailyPlanData se presente.DailyPlanData nel servizio.Clear Plan Targets per il tipo di piano Plan1.LoadDailyPlan.Balance Sheet - Plan.Allocate Plan Targets.DailyTarget.zip se presente.DailyTarget.zip utilizzando il nome di job ExportDailyTarget.DailyTarget.zip sul server e aggiungere l'indicatore orario.Nota:
Se si assegna un nuovo scopo a questo script per un uso personale, assicurarsi di modificare i valori dei parametri SET url e SET user. Inoltre, è possibile modificare i valori dei parametri dataimportfilename, dataexportfilename, importdatajobname, exportdatajobname, br_clear, br_calculatebalancesheet e br_allocatetarget in base alle proprie esigenze.
Vedere Automazione dell'esecuzione degli script per informazioni su come pianificare lo script mediante Utilità di pianificazione di 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%