WRKFORCE: Simple Change Makes Huge Differences in TRANSFER

In WRKFORCE, you can transfer menu to transfer Employee from Department to Department. The original Business Rule takes about about seven minutes to complete with is painful to users. Further more, after 80+ employees are transferred, one of the calculation script (CurPlnPr), used to take 1~2 minutes to complete, now shot up to an hour and twenty minutes.

Let's take a look at the original Rule in Transfer -

/* Description: Employee Transfer between Division & Department*/

/*STARTCOMPONENT:SCRIPT*/
SET LOCKBLOCK HIGH;
SET AGGMISSG ON;
SET CACHE HIGH;
SET UPDATECALC OFF;
/*ENDCOMPONENT*/
/*STARTCOMPONENT:SCRIPT*/
SET CREATENONMISSINGBLK ON;

VAR yearTransfer = 0;
VAR savedAction = 0;
/*ENDCOMPONENT*/


FIX (/*DIM:Year*/{Years},/*DIM:Employee*/{Employees},/*DIM:Scenario*/{Scenario},/*DIM:Version*/{Version},/*DIM:Currency*/{Currency})
  /*STARTCOMPONENT:SCRIPT*/
  DATACOPY {FromDivision}->{FromDepartment} TO {ToDivision}->{ToDepartment};

"PrevCYTDTotalSalary"
(
{ToDivision}->{ToDepartment}->"BegBalance" = #Missing;
{ToDivision}->{ToDepartment}->"BegBalance" = {FromDivision}->{FromDepartment}->{Month}->"CYTD Total Salary (Prior)" +
                         {FromDivision}->{FromDepartment}->"BegBalance"->"PrevCYTDTotalSalary";
)
  "Action"
  (
  IF (@ISMBR(&CurrPlanYr1))
     yearTransfer = 2;
  ENDIF            
  )
  /*ENDCOMPONENT*/
ENDFIX
FIX (/*DIM:Year*/{Years},/*DIM:Employee*/{Employees},/*DIM:Scenario*/{Scenario},/*DIM:Periods*/@LEVMBRS("Periods", 0),/*DIM:Version*/{Version},/*DIM:Department*/{FromDepartment},/*DIM:Division*/{FromDivision},/*DIM:Currency*/{Currency})
 
  "Action"(
    IF ("Fiscal TP-Index" == {Month}->"Fiscal TP-Index")
      /*STARTCOMPONENT:FORMULA*/
      "Action" = 7;
      /*ENDCOMPONENT*/
    ELSEIF ("Fiscal TP-Index" > {Month}->"Fiscal TP-Index")
      /*STARTCOMPONENT:FORMULA*/
      "Action" = #MISSING;
      /*ENDCOMPONENT*/
    ENDIF
  )
  /*STARTCOMPONENT:SCRIPT*/
  CALC DIM ("Account");
  /*ENDCOMPONENT*/
ENDFIX
FIX (/*DIM:Year*/{Years},/*DIM:Employee*/{Employees},/*DIM:Scenario*/{Scenario},/*DIM:Period*/@LEVMBRS("Periods", 0),/*DIM:Version*/{Version},/*DIM:Department*/{ToDepartment},/*DIM:Division*/{ToDivision},/*DIM:Currency*/{Currency}) 
  "Action"(
    IF ("Fiscal TP-Index" == {Month}->"Fiscal TP-Index")
      /*STARTCOMPONENT:FORMULA*/
      "Action" = 8;
      /*ENDCOMPONENT*/
    ELSEIF ("Fiscal TP-Index" < {Month}->"Fiscal TP-Index")
      /*STARTCOMPONENT:FORMULA*/
      "Action" = #MISSING;
      /*ENDCOMPONENT*/
    ELSEIF (savedAction <> 7 AND "Action" == 8)
      /*STARTCOMPONENT:FORMULA*/
      "Action" = #MISSING;
      /*ENDCOMPONENT*/
    ELSEIF ("Action" == 7)
      /*STARTCOMPONENT:FORMULA*/
      savedAction = 7;
      /*ENDCOMPONENT*/
    ELSE
      /*STARTCOMPONENT:FORMULA*/
      "Action" = #MISSING;
      /*ENDCOMPONENT*/   
     ENDIF
  )
  /*STARTCOMPONENT:SCRIPT*/
  CALC DIM ("Account");
  /*ENDCOMPONENT*/
ENDFIX

FIX (/*DIM:Year*/@RSIBLINGS({Years}),/*DIM:Employee*/{Employees},/*DIM:Scenario*/{Scenario},@LEVMBRS("Periods", 0),/*DIM:Version*/{Version},/*DIM:Currency*/{Currency})
  /*STARTCOMPONENT:SCRIPT*/

  DATACOPY {FromDivision}->{FromDepartment} TO {ToDivision}->{ToDepartment};
 "Action"
 (   
  IF (@ISMBR("Jan"))
    {ToDivision}->{ToDepartment} = 8;
      {FromDivision}->{FromDepartment} = 7;
  ELSE   
    {ToDivision}->{ToDepartment} = #MISSING;
      {FromDivision}->{FromDepartment} = #MISSING;
 ENDIF            
 )
  CALC DIM ("Account");
 /*ENDCOMPONENT*/
ENDFIX;
 

Look closely in the last section of FIX statement, that RSIBLINGS({Years}) is actually calculate DIM ("Account") for ALL departments, not the user selected FROM and TO departments. This not only makes this rule slow, but also generates large amount of data for ALL departments, since it calculates for ALL years and ALL departments.

The issue is now identified. After changes are applied, the TRANSFER runs ~20 seconds, and the consolidation and mapping script takes about 2 minutes to finish, no matter how many Employees are transferred.

Here is the modified rule (only showing the last section):

FIX (@RSIBLINGS({Years}),{Employees},{Scenario},@RELATIVE("Periods", 0),{Version},{Currency})
  DATACOPY {FromDivision}->{FromDepartment} TO {ToDivision}->{ToDepartment};
 "Action"
(IF (@ISMBR("Jan"))
    {ToDivision}->{ToDepartment} = 8;
      {FromDivision}->{FromDepartment} = 7;
  ELSE   
    {ToDivision}->{ToDepartment} = #MISSING;
      {FromDivision}->{FromDepartment} = #MISSING;
 ENDIF)
ENDFIX


FIX (@RSIBLINGS({Years}),{Employees},{Scenario},@RELATIVE("Periods", 0),{Version},{FromDepartment},{FromDivision},{Currency})
CALC DIM ("Account");
ENDFIX;

Comments

Popular posts from this blog

ESSBASE: When to Use FIX vs. IF

Essbase Currently Not Accepting Connections

HFM: Performance Tuning on Application