Remember value of global variable from one extract loop to the other

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Remember value of global variable from one extract loop to the other


      I've noticed an odd behaviour when transforming a Palo cube extract via a groovy script. The tranformation process just adds a column to the extract which is based on an ETL variable.

      The column which is added to the cube extract is the one with the header "Value". I would expect my script to just count up from 1 to xxx line by line but that's not the case (I know there is a special transformation function for doing this usually but as I have just simplified my problem here this function cannot be used).
      However, the output of my script does not count from 1 to 7 (as it should be in the example below) but it starts from scratch sometimes (which means that the value of the global variable gets lost??? and sometimes the setProperty method is just not executed).

      For me it seems that it has something to do with the hierarchy in the Days dimension but I can't completely understand who it works at the moment. ! The extract process is configured to use base elements only !.

      In summary: I try to remember a variable from one extract row to the next. I'm of course open to other ways to solve my requirement but I didn't find an alternative to the one with the global ETL variable. Using the script below I would expect the Value colum to have the values (1,2,3,4,5,6,7) insead of (1,2,2,2,3,4,2).

      [Blocked Image:]

      The script exists of these four lines:

      Source Code

      1. newBalance=API.getProperty("CurrentLoopBalance").toDouble();
      2. newBalance = newBalance + 1;
      3. API.setProperty("CurrentLoopBalance", newBalance.toString());
      4. return newBalance;

      Any ideas would be very appreciated.