Passing parameters from one Grrovy Job to another Groovy Job

      Passing parameters from one Grrovy Job to another Groovy Job

      Hi,

      I hope Jedox experts in forum can help me with this.

      I have created a Groovy function in a Groovy Job
      which takes a value x and performs a calculation.
      I want to call this Groovy Job from another Groovy Job at the same time passing a new value for x.

      Here is the example:

      The Groovy Job called 'MyFn' has the following code:

      Source Code

      1. def test(int x) {
      2. int a = x * 2;
      3. }



      Also I have another Groovy Job called, 'CallFn' and used it to call the above Groovy Job.
      The code as follows:

      Source Code

      1. API.executeJob("MyFn");


      How can I set the value of x to say 10 in the 'MyFn' Job, from the 'CallFn' Job?

      Many thanks,

      Chesmi
      Hi,

      you have 2 possibilities:

      1/ you put your function test() in the same groovy job and call the function accordingly, for instance:

      Source Code

      1. def test(int x) {
      2. int a = x * 2;
      3. }
      4. // should log 6
      5. LOG.info(test(3));


      2/ you use the context variables to set and get the variables (API.setProperty and API.getProperty) before launching the "MyFn" job
      laloune

      Post hoc, non est propter hoc
      Thanks Laloune for quick reply.

      The first option can not be used to replicate the Groovy Job.

      By the way I am thinking of is there any way to do this without using context variables ?
      Because as my understanding we have to use that same context variable in 'MyFn' Groovy Job as well.