Submitting a Data Load Rule
This example shows how to submit a data load rule by way of a script.
#This sample Jython script provides code related to custom scripts. All the messages being logged (meaning printed) are visible in the process lLog Level profile.## Log the beginning of the script, at the INFO level
fdmAPI.logInfo("======================================================================")
fdmAPI.logInfo("Custom Script: Begin")
fdmAPI.logInfo("======================================================================")# Log the target application name from the context, at the DEBUG level
fdmAPI.logDebug("Target App Name = " + fdmContext["TARGETAPPNAME"])# Log the script name from the context at the DEBUG level
fdmAPI.logDebug("Custom Script name = " + fdmContext["SCRIPTFILE"])
# Get all script parameters and log their names and values at the DEBUG level
fdmAPI.logDebug("Custom script parameter values by name: begin")fdmAPI.logDebug("The value of parameter CUSTOM_LOCATION is = " + fdmAPI.getCustomScriptParameterValue("CUSTOM_LOCATION"))fdmAPI.logDebug("The value of parameter CUSTOM_YEAR is = " + fdmAPI.getCustomScriptParameterValue("CUSTOM_YEAR"))fdmAPI.logDebug("Custom script parameter values by name: end")# Example submitting a data ruleimport osimport subprocessos.chdir("C:/Oracle/Middleware/user_projects/epmsystem1/FinancialDataQuality")myScriptName = "C:/Oracle/Middleware/user_projects/epmsystem1/FinancialDataQuality/loaddata.bat"command = '%s "%s" "%s" "%s" "%s" "%s" "%s" "%s" "%s" "%s" "%s" "%s"' % (myScriptName, "admin", "password", "SRESBA1_DR1", "Y", "N", "STORE_DATA", "SNAPSHOT", "N", "Jan-2003", "Jan-2003", "ASYNC")fdmAPI.logDebug("Submitting a data rule via a script using the following command: " + command)retcode = subprocess.Popen(command)fdmAPI.logDebug("Data rule submitted fine.")# Close the connection and log the end of the script, at INFO levelfdmAPI.closeConnection()fdmAPI.logInfo("======================================================================")fdmAPI.logInfo("Custom Script: end")fdmAPI.logInfo("======================================================================")
The output for the executed custom script is:
2013-09-25 08:12:26,080 INFO [AIF]: ==========================================================================2013-09-25 08:12:26,081 INFO [AIF]: Custom Script: Begin2013-09-25 08:12:26,082 INFO [AIF]: ==========================================================================2013-09-25 08:12:26,083 DEBUG [AIF]: Target App Name = SRESBA12013-09-25 08:12:26,084 DEBUG [AIF]: Custom Script name = SRCustomScript1.py2013-09-25 08:12:26,087 DEBUG [AIF]: CUSTOM_LOCATION = 12013-09-25 08:12:26,087 DEBUG [AIF]: CUSTOM_YEAR = 20132013-09-25 08:12:26,088 DEBUG [AIF]: Custom script parameter values by name: begin2013-09-25 08:12:26,091 DEBUG [AIF]: The value of parameter CUSTOM_LOCATION is = 12013-09-25 08:12:26,093 DEBUG [AIF]: The value of parameter CUSTOM_YEAR is = 20132013-09-25 08:12:26,094 DEBUG [AIF]: Custom script parameter values by name: end2013-09-25 08:12:26,535 DEBUG [AIF]: Submitting a data rule via a script using the following command: C:/Oracle/Middleware/user_projects/epmsystem1/FinancialDataQuality/loaddata.bat "admin" "****" "SRESBA1_DR1" "Y" "N" "STORE_DATA" "SNAPSHOT" "N" "Jan-2003" "Jan-2003" "ASYNC"2013-09-25 08:12:26,596 DEBUG [AIF]: Data rule submitted fine.2013-09-25 08:12:26,635 INFO [AIF]: ==========================================================================2013-09-25 08:12:26,636 INFO [AIF]: Custom Script: end2013-09-25 08:12:26,637 INFO [AIF]: ==========================================================================