Forum Stats

  • 3,759,065 Users
  • 2,251,495 Discussions
  • 7,870,478 Comments

Discussions

fdmContext in Custom script

EduardoAlmeida
EduardoAlmeida Member Posts: 35 Blue Ribbon
edited Nov 3, 2015 9:41AM in Financial Data Management

Good morning everyone,

I'm struggling with one issue on a custom script in FDMEE.

I have a custom jython script that is calling a ODI scenario. My problem is how to pass the POV selected in fdm to the ODI scenario?? I need to get Period information inside of my ODI package.

POV_Selected.PNG

How can I achieve this?

Thank you very much!!!

Best Regards,

Eduardo Almeida

Tagged:
Dayalan PunniyamoorthyWayneX

Best Answer

  • SH_INT
    SH_INT Member Posts: 3,187 Bronze Crown
    edited Nov 3, 2015 9:16AM Accepted Answer

    Your other issue is that fdmContext won't be initialised in a custom script. If you need to get the period from FDMEE into the ODI scenario you will need to setup a custom script parameter that takes the FDMEE Period POV value as an input which you can then retrieve in your custom script using the following API command - fdmAPI.getCustomScriptParameterValue("ParameterName")

    You would then pass that value as a variable argument to the ODI Scenario

Answers

  • ThinkFDM
    ThinkFDM Member Posts: 224 Silver Badge
    edited Nov 3, 2015 6:42AM

    These fmContenxt properties should get you what you need.

    • Period Name - fdmContext["PERIODNAME"]
    • Period Key - fdmContext["PERIODKEY"]

    See Using the JAVA API in the FDMEE Admin Guide for more info.

    EduardoAlmeida
  • SH_INT
    SH_INT Member Posts: 3,187 Bronze Crown
    edited Nov 3, 2015 6:53AM

    What are you having issues with here using fdmContext in a custom script or how to get values from FDMEE into an ODI scenario called from a custom script?

    If the later it should be pretty straightforward. Assuming that you are executing the ODI scenario from your script using the ODIStartScen script then all you need to do is ensure that you have configured some startup variables on your scenario and then pass the FDMEE POV values in those variables on the startscen commad i.e. on windows it would be startscen.bat YourScenario ScenarioVersion Context LogLevel "VariableName=FDMPOV_Value"

    Dayalan PunniyamoorthyEduardoAlmeida
  • EduardoAlmeida
    EduardoAlmeida Member Posts: 35 Blue Ribbon
    edited Nov 3, 2015 7:44AM

    Hi ThinkFDM and SH, thanks for the quick replay

    Both your answers help but still I've got something missing.

    My code:

    fdmAPI.logInfo("======================================================================")

    fdmAPI.logInfo("Start - LOAD ODI PACKAGE")

    fdmAPI.logInfo("======================================================================")

    ################################################ Run ODI To Validate if context is Open

    import os

    import subprocess

    os.chdir("C:\\Oracle\\product\\11.1.1\\Oracle_ODI_1\\oracledi\\agent\\bin")

    pScriptName = "C:\\Oracle\\product\\11.1.1\\Oracle_ODI_1\\oracledi\\agent\\bin\\startscen.bat"

    pODIScenario="TESTE_ODI"

    command = '%s "%s" "%s" "%s" "%s" "CUSTOM_EBS_GL_HFM_ADPT.p_period_name=%s"' % (pScriptName, pODIScenario, "001", "GLOBAL", u"-NAME=OracleDIAgent",fdmContext["PERIODNAME"])

    retcode = subprocess.Popen(command)

    #fdmAPI.logDebug("ODI Scenario submitted fine.")

    retcode.wait()

    # Close the connection and log the end of the script, at INFO level

    fdmAPI.closeConnection()

    fdmAPI.logInfo("======================================================================")

    fdmAPI.logInfo("End - LOAD LOAD ODI PACKAGE")

    fdmAPI.logInfo("======================================================================")

    ODI result:

    ODI.PNG

    When I print my variable value result it gives me "None".

    Am I missing something?

    Thanks guys!

    Best Regards,

    Eduardo Almeida

  • SH_INT
    SH_INT Member Posts: 3,187 Bronze Crown
    edited Nov 3, 2015 8:22AM

    Have you exposed the variable as a startup parameter i.e. when you compiled the ODI scenario did you check the checkbox next to to the variable?

  • SH_INT
    SH_INT Member Posts: 3,187 Bronze Crown
    edited Nov 3, 2015 9:16AM Accepted Answer

    Your other issue is that fdmContext won't be initialised in a custom script. If you need to get the period from FDMEE into the ODI scenario you will need to setup a custom script parameter that takes the FDMEE Period POV value as an input which you can then retrieve in your custom script using the following API command - fdmAPI.getCustomScriptParameterValue("ParameterName")

    You would then pass that value as a variable argument to the ODI Scenario

  • EduardoAlmeida
    EduardoAlmeida Member Posts: 35 Blue Ribbon
    edited Nov 3, 2015 9:23AM

    Yes, I did expose my variable as a startup parameter.

    ODI1.PNG

    But now I believe that the problem is before getting into ODI package. I tried to print my variable into the log using fdmAPI.logInfo("Context: " + str(fdmContext["PERIODNAME"])) and it throws it prints None

  • EduardoAlmeida
    EduardoAlmeida Member Posts: 35 Blue Ribbon
    edited Nov 3, 2015 9:24AM

    Ahhhhh

    I'll try that!

  • EduardoAlmeida
    EduardoAlmeida Member Posts: 35 Blue Ribbon
    edited Nov 3, 2015 9:41AM

    @SH Thank you so much for the help!

    It worked! now my ODI variable prints "01-DEC-2014".

    To finalize, is there any option to make my custom script parameter hidden? Because I already have my POV selected and I notice that by default it initialize with the current selection so user didn't need to be prompted. (But that is already an enhancement )

    Resume of the answer:

    1. In ODI, when generating the scenario expose the variable as a Startup Paremeter.
    2. In custom scripts, fdmContext won't be initialised. If you need to get the period from FDMEE into the ODI scenario you will need to setup a custom script parameter that takes the FDMEE Period POV value as an input which you can then retrieve in your custom script using the following API command - fdmAPI.getCustomScriptParameterValue("ParameterName")
    3. Pass the FDMEE POV values in those variables on the startscen commad i.e. on windows it would be startscen.bat YourScenario ScenarioVersion Context LogLevel "VariableName=FDMPOV_Value"

    Once again, thank you very much for the help!

    Best regards,

    Eduardo Almeida


    WayneX
This discussion has been closed.