11 Replies Latest reply: Jun 19, 2014 5:28 PM by Francisco Amores RSS

    FDMEE BefImport

    user8030589

      Hi All,

       

      We have successfully created two Jython scripts that grab data from 3rd party sql databases and populate the AIF tables and successfully import, validate and export.  These are housed in the BefImport event script.  Since we pull data from multiple source databases (EBS, HFM, Accpac, SUN, etc.), will our BefImport event script just keep growing as we add new connections and queries?  Or is there a way to have multiple BefImport scripts (like we could do with regular Import scripts in Classic)...or can we somehow have multiple FDM applications (like in Classic) rather than them all being in one place?

       

      Also, I have noticed that importing data into FDMEE seems to run the validation at the same time.  You can see your validation errors by only pressing import.  Is this a default setting or something you can turn off and go back to import and validating seperately?  Not sure if I like or dislike but just want to know my options.

       

      Much Appreciated,

      Mike

        • 1. Re: FDMEE BefImport
          KKT

          below reply to your queries-

           

          there a way to have multiple BefImport scripts (like we could do with regular Import scripts in Classic)...or can we somehow have multiple FDM applications (like in Classic) rather than them all being in one place? -- Yes Create the seperate locations and attach the same script that you have created to locations and restrict in seperate location the data only for particular Year or CostCenters.

           

          You can see your validation errors by only pressing import.  Is this a default setting or something you can turn off and go back to import and validating seperately? - Validation in fdmee is slightly different from FDM classic , In oder o check Validation is working or not go to particular fdm location and add explicit mapping instead of "*" and check.

           

          let us know if that ok or you need more information.

           

          Thanks,

          ~KKT~

          • 2. Re: FDMEE BefImport
            Francisco Amores

            Hi,

             

            We have successfully created two Jython scripts that grab data from 3rd party sql databases and populate the AIF tables and successfully import, validate and export.  These are housed in the BefImport event script.  Since we pull data from multiple source databases (EBS, HFM, Accpac, SUN, etc.), will our BefImport event script just keep growing as we add new connections and queries?  Or is there a way to have multiple BefImport scripts (like we could do with regular Import scripts in Classic)...or can we somehow have multiple FDM applications (like in Classic) rather than them all being in one place?

            You can only have one BefImport Script. If you are using Open Interface Adapter, you could also have separate ODI projects for each source so you don't need the BefImport.

            FDMEE and FDM are different regarding integration scripts. In FDMEE, the integration script is replaced by either ODI process or BefImport Script.

            There would be another option to have separate scripts. You can have 1 BefImport event script which calls external functions built in other scripts.  In that way you could have BefImport_HFM.py, BefImport_EBS.py,... and the original BefImport.py. This last script would call the different functions in the other scripts based on your source.

             

            Also, I have noticed that importing data into FDMEE seems to run the validation at the same time.  You can see your validation errors by only pressing import.  Is this a default setting or something you can turn off and go back to import and validating seperately?  Not sure if I like or dislike but just want to know my options.

            They are executed in one shot. You can then execute validate separately without import. But anytime you click Import, then Validate is executed.

            • 3. Re: FDMEE BefImport
              user8030589

              Great thx Francisco.  I don't suppose you have a sample of how to call one script from another within fdm jython?

               

              Much Appreciated,

              Mike

              • 4. Re: FDMEE BefImport
                user8030589

                Hi Francisco,

                 

                Just wanted to ask again...I don't suppose you have an example of calling functions from one FDMEE jython script to another?  Would be a great help as we have most of our scripts sitting in one big BefImport script right now.

                 

                Greatly Appreciated if so.

                 

                Thx,

                Mike

                • 5. Re: FDMEE BefImport
                  Francisco Amores

                  Hi,

                   

                  You can add to your event script something like:

                   

                  # Using an external library

                  import sys

                  sys.path.append('E:\\EPM_APPS\\FDMEE\\COMMA4DIM\\data\\scripts\\event')

                  try:

                    import functions

                  except Exception, err: fdmAPI.logInfo("Error importing functions module:" + str(err))

                   

                  functions is the name of the file (functions.py in event folder)

                   

                  and then call your function:

                  functions.functioname(parameters)

                  • 6. Re: FDMEE BefImport
                    user8030589

                    Great thx Francisco.  It worked.  We were able to call a function in script 2 from script 1.  We are now looking at our Before Import script and seeing that we will most likely need to pass the fdmAPI session from script 1 to script 2.  The reason we say this is because we need to do an fdmAPI.execute DML statement to update the AIF table while looping through our recordset in script 2.  A simple example of what we are talking about is shown below:

                     

                    Script1.py

                    import Script2

                    Script2.printTest()

                     

                    Script2.py

                    def printTest():

                      fdmAPI.logInfo("Hello World")

                     

                    This would fail because Script2 doesn't have access to the fdmAPI session.

                     

                    Thank you once again....your help is greatly appreciated.

                    Mike

                    • 7. Re: FDMEE BefImport
                      Francisco Amores

                      You can pass fdm objects as parameters

                       

                      Script1.py

                      import Script2

                      Script2.printTest(fdmAPI)

                       

                      Script2.py

                      def printTest(fdmAPI):

                        fdmAPI.logInfo("Hello World")

                      • 8. Re: FDMEE BefImport
                        user8030589

                        Thx Francisco, however this isn't working for us.

                         

                        When we run what you have provided, we get the error 'printTest() takes no arguments (1 given)'.  Any ideas?

                         

                        Would we not have to manually initialize the FDM such as mentioned in the Admin Guide (code below)?  It doesn't seem like script 2 would know what FDMAPI is by just passing it as a parameter.  Would we not need to add something like below to Script #2...or Script #1?

                         

                        import java.math.BigDecimal as BigDecimal
                        import java.sql as sql
                        import com.hyperion.aif.scripting.API as API

                        fdmAPI = API()
                        conn = None
                        conn = sql.DriverManager.getConnection(r"jdbc:weblogic:sqlserver://servername:port;databaseName=db_FDMEE; loadLibraryPath=D:\Oracle\Middleware\wlserver_10.3\server\lib",username, password)
                        conn.setAutoCommit(False)
                        fdmAPI.initializeDevMode(conn)
                        fdmAPI.logInfo("SUCCESS CONNECTING TO DB")
                        #fdmContext = fdmAPI.initContext(BigDecimal(1720))

                         

                        We think we're close but we're stuck on this.

                         

                        Any help is greatly appreciated.

                         

                        Mike

                        • 9. Re: FDMEE BefImport
                          Francisco Amores

                          Did you initially define printTest with no parameters.

                          That error is saying that you are passing one parameter and that was not expected.

                          your real issue is that your old function is loaded to the system path. If you change your second script after is added to the system path by 1st script, you will have to restart FDMEE service in order to add the 2nd script to

                          the system path again. Then your function with one parameter will be available and you can pass fdmAPI object to it.

                           

                          So restart and it will work.

                           

                          regards

                          • 10. Re: FDMEE BefImport
                            user8030589

                            It worked!  Thx Francisco.  Everything was fine once we restarted the service.  We also passed the fdmContext into script2 as well so our script2 is just a copy paste from our original BefImport script.

                             

                            Thanks for all your help.

                             

                            Mike

                            • 11. Re: FDMEE BefImport
                              Francisco Amores

                              No problem.

                              Glad to hear it is working as expected.


                              Regards