Import Data and Run Program Rules

Use these scripts to upload data files and to import data from the uploaded files into a Profitability and Cost Management business process.

These scripts complete the following steps:

  • Sign in to the environment.
  • Uploads a data file containing the data to load.
  • Uploads rule file containing data rules.
  • Loads data from the data file into application to overwrite existing values.
  • Runs all rules in the rule file.
  • Signs out.

Windows Script

Create a file named importData.ps1 by copying the following script. Store it in a local directory.
$inputproperties = ConvertFrom-StringData(Get-Content ./input.properties -raw)
$username="$($inputproperties.username)"
$passwordfile="$($inputproperties.passwordfile)"
$serviceURL="$($inputproperties.serviceURL)"
$applicationName="$($inputproperties.applicationName)"
$dataFileName="$($inputproperties.dataFileName)"
$rulesFileName="$($inputproperties.rulesFileName)"
$fileDestination="$($inputproperties.fileDestination)"
$clearAllDataFlag="$($inputproperties.clearAllDataFlag)"
$dataLoadValue="$($inputproperties.dataLoadValue)"

epmautomate login ${username} ${passwordfile} ${serviceURL}
epmautomate uploadfile "${dataFileName}" ${fileDestination}
epmautomate uploadfile "${rulesFileName}" ${fileDestination}
epmautomate loaddata ${applicationName} clearAllDataFlag=${clearAllDataFlag} dataLoadValue=${dataLoadValue} rulesFileName="${rulesFileName}" dataFileName="${dataFileName}"
epmautomate logout

Linux/UNIX Script

Create a file named importData.sh by copying the following script. Store it in a local directory.
#!/bin/bash
. ./input.properties
export JAVA_HOME=${javahome}
${epmautomatescript} login "${username}" "${passwordfile}" "${serviceURL}"
${epmautomatescript} uploadfile "${dataFileName}" "${fileDestination}"
${epmautomatescript} uploadfile "${rulesFileName}" "${fileDestination}"
${epmautomatescript} loaddata "${applicationName}" "clearAllDataFlag=${clearAllDataFlag}" "dataLoadValue=${dataLoadValue}" rulesFileName="${rulesFileName}" dataFileName="${dataFileName}"
${epmautomatescript} logout

Creating the input.properties File

To run the importData scripts, create the input.properties file and update it with information for your environment. Save the file in the directory where importData.ps1 or importData.sh is stored.

Windows


username=exampleAdmin
passwordfile=examplePassword.epw
serviceURL=exampleURL
applicationName=APPLICATION_NAME
dataFileName=DATA_FILE.txt
rulesFileName=RULE_FILE.txt
fileDestination=profitinbox
clearAllDataFlag=true
dataLoadValue=OVERWRITE_EXISTING_VALUES
Linux/UNIX
javahome=JAVA_HOME
epmautomatescript=EPM_AUTOMATE_LOCATION
username=exampleAdmin
passwordfile=examplePassword.epw
serviceURL=exampleURL
applicationName=APPLICATION_NAME
dataFileName=DATA_FILE.txt
rulesFileName=RULE_FILE.txt
fileDestination=profitinbox
clearAllDataFlag=true
dataLoadValue=OVERWRITE_EXISTING_VALUES

Table 3-26 input.properties Parameters

Parameter Description
javahome JAVA_HOME location. For Linux/UNIX only.
epmautomatescript Absolute path of EPM Automate executable (epmautomate.sh). For Linux/UNIX only.
username User name of a Service Administrator, who also has the Identity Domain Administrator role.
password Password of the Service Administrator or the name and location of the encrypted password file.
serviceURL URL of the environment from which you want to generate the snapshot.
applicationName Name of the Profitability and Cost Management into which data is to be loaded.
dataFileName Name of the file containing the data to be imported.
rulesFileName Name of the file containing the rules to be run on the imported data.
fileDestination Location to which the data and rules files are to be uploaded.
clearAllDataFlag Specifies whether to clear existing data in the application cube. Set to false if you do not want to clear existing data.
dataLoadValue specifies how to handle existing data. Specify ADD_TO_EXISTING if you want to retaining existing data in the cube.

Running the Scripts

  1. Create importData.ps1 or importData.sh by copying the script from a preceding section.
  2. Create the input.properties file and save it in the directory where the importData script is located. Contents of this file differs depending on your operating system. See Creating the input.properties File.

    Make sure that you have write privileges in this directory. For Windows, you may need to start PowerShell using the Run as Administrator option to be able to run the script.

  3. Launch the script.
    • Windows PowerShell: run importData.ps1.
    • Linux/UNIX: run ./importData.sh.