Wednesday, February 10, 2016

Fun with Jython and FDMEE

The past few months I have had the opportunity to assist in FDM to FDMEE migrations and during that time I have been able to explore Jython scripting.
I have loved programming since I was in high school and wrote my first program on an Apple 2.  Yeah, a very long time ago.  No matter where my career path has taken me I seem to find a way back into some form of programming.
As part of the migration efforts I needed to convert the FDM VBScript to Jython.  While some of the Event Scripts could have been kept in VBScript it was cleaner to convert to Jython for 2 reasons...VBScript is not strategic for Oracle with FDMEE and I like a puzzle.
One of the migrations I had was from FDM Classic with the Essbase Source Adapter to FDMEE  This particular client had stored email server and email addresses in the integration settings to be used to send an email upon failure during any part of the data loading done by FDMEE.
The one thing I did not want to do was to embed this information in my each one of my Event Scripts - AftImport, AftValidate, AftExportToDat, AftLoad, AftCheck...
So where could I store this information and yet make it accessible to easily modify once.  Why not the Integration Options for a Location?
If I look at the TPOVPARTION table which stores location information is the 4 Integration Option values.
A simple SQL statement

So how do I get these easily without having to write SQL in my Jython?

Enter the FDMEE API and particularly the 
     getLocationDetails(BigDecimal pPartitionKey)
So what does this look like in Jython in my Eclipse editor?
And the Output...

So putting it into my FDMEE Event Scripts...

Now the neat thing about this approach is the if there are different people responsible for different locations they could get individual emails when there is an issue with their location by switching out the hardcoded fdmLocID to the fdmContext["LOCKEY"].

Well that was a fun diversion from BI and since I am having fun with Jython and FDMEE I may find some other neat tidbits to share in the future.