Ce scénario porte sur l'utilisation d'un exemple de script pour automatiser l'intégration régulière des données.
Créez un fichier de lot (.bat) ou d'interpréteur de commandes (.sh) qui contient un script semblable aux scripts suivants pour automatiser les activités relatives à l'intégration des données. Le script d'exemple suivant pour Windows automatise l'intégration quotidienne des données d'application en réalisant ces activités :
DailyPlanData s'il est présent.DailyPlanData dans le service.Clear Plan Targets sur le type de plan Plan1.LoadDailyPlan.Balance Sheet - Plan.Allocate Plan Targets.DailyTarget.zip s'il est présent.DailyTarget.zip à l'aide du nom de job ExportDailyTarget.DailyTarget.zip vers votre serveur et ajoutez l'horodatageRemarque :
Si vous réadaptez ce script à votre utilisation personnelle, veillez à modifier les valeurs des paramètres SET url et SET user. En outre, vous pouvez modifier les valeurs des paramètres dataimportfilename, dataexportfilename, importdatajobname, exportdatajobname, br_clear, br_calculatebalancesheet et br_allocatetarget afin qu'ils répondent à vos besoins.
Reportez-vous à la section Automatisation de l'exécution de scripts pour plus d'informations sur la planification du script à l'aide du planificateur de tâches 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%