Forum Stats

  • 3,873,311 Users
  • 2,266,534 Discussions
  • 7,911,502 Comments

Discussions

ODI API & Groovy: Procedure Options in Package

mcoene
mcoene Member Posts: 29 Blue Ribbon

Hi all,

I am building some automation scripts in Groovy.

One is to automatically create some of the package we are using when integrating data.

One of the step in such a package is a procedure which has 1 option. In my Groovy script, I need to set this option, but when I look at my generated package, the procedure step always shows the default value for that option.

As a test, I tried adding another option using groovy code, but this new option is also not visible in the generated package.

What am I missing?

(Groovy code relevant to the question below)

procs = procf.findByName("Proc. Initialize CDC Controle Record")

 for(proc in procs) {

  if(proc.getName() == "Proc. Initialize CDC Controle Record")

  { procInitCDC = proc }

 }

  

 procInitCDC.removeOption(procInitCDC.getProcedureOption("CDC_TYPE"))

 procInitCDC.addOption("CDC_TYPE", ProcedureOption.OptionType.valueOf("SHORT_TEXT"),"DERIVED")

 procInitCDC.addOption("CDC_TYPE_TEST", ProcedureOption.OptionType.valueOf("SHORT_TEXT"),"DERIVED")

step03 = new StepProcedure(pack, procInitCDC, "Proc. Initialize CDC Controle Record")

// I even read the options in the StepProcedure and both options show up in the log just fine

 pos = step03.getProcedureOptions()

 for(po in pos) {

  log.append(po.getName()+" "+po.getValue()+"\n")

 }

 

Tagged:

Best Answer

  • mcoene
    mcoene Member Posts: 29 Blue Ribbon
    Answer ✓

    Appartently you cannot "build" a procedure and then use that built procedure to create your StepProcedure


    Instead, you need to create your StepProcedure, then go through all options of the procedure used in your StepProcedure, and THEN modify the values for the option you want to modify


    Not really the steps I expected I had to take, but ok

    Solution Code:

    StepProcedure step03 = new StepProcedure(pack, procInitCDC, "Proc. Initialize CDC Controle Record")


     pos = step03.getProcedureOptions()

     for(po in pos) {

      if(po.getName() == "CDC_TYPE") { po.setValue("DERIVED") }

     }

Answers

  • mcoene
    mcoene Member Posts: 29 Blue Ribbon
    Answer ✓

    Appartently you cannot "build" a procedure and then use that built procedure to create your StepProcedure


    Instead, you need to create your StepProcedure, then go through all options of the procedure used in your StepProcedure, and THEN modify the values for the option you want to modify


    Not really the steps I expected I had to take, but ok

    Solution Code:

    StepProcedure step03 = new StepProcedure(pack, procInitCDC, "Proc. Initialize CDC Controle Record")


     pos = step03.getProcedureOptions()

     for(po in pos) {

      if(po.getName() == "CDC_TYPE") { po.setValue("DERIVED") }

     }