Forum Stats

  • 3,814,216 Users
  • 2,258,841 Discussions
  • 7,892,625 Comments

Discussions

I have a lengthy business rule 600+ lines, and I want to condense this by making the rule dynamic.

Rohan Mahmood
Rohan Mahmood Member Posts: 1 Green Ribbon

I have a business rule which has a set of code, repeated except the member for which it runs changes every section of the code.

I am looking to condense the code by somehow concatenating or referencing the code to run for ALL members under that same parent in the particular dimension.

Below is a snippet of my code for 1 member "T1" (it is in bold and italics where it is referenced):

SET AGGMISSG ON;

SET FRMLBOTTOMUP ON;

/*Smart list Approval Status

1 = Pending Approval

2 = Approval

3 = Rejected

*/

/*Primary FIX Statement */

FIX ( /*{Scenario}*/ "OEP_Plan", "Working"/*Version*/, "GBP" /*Currency*/ "FY24" /*Year*/ /*Period*/)

/* Clear out pending and approved amounts */

"Trans_In_Pending" = #missing;

"Trans_Out_Pending" = #missing;

"Trans_In" = #missing;

"Trans_Out" = #missing;

/* Fix on request transactions first */

FIX ( @RELATIVE("BAT",0), "No Entity" /*Entity*/ /*No Objective*/, "No Analysis 1" /*Analysis1*/, "No Analysis 2"/*Analysis2*/ )

/* Checking if user has completed all fields and submitted */

"T1"(IF ("Date_Requested" <> #Missing AND

  "Description" <> #Missing AND

   "Contact_Name" <> #Missing AND

   "Transfer_Input" <> #Missing AND

   "Source_Cost_Centre" <> #Missing AND

   "Source_Account" <> #Missing AND

   "Target_Cost_Centre" <> #Missing AND

   "Target_Account" <> #Missing AND

"Submit_Status" == 1)

/* Set to Pending Transfer, calculate requests transactions on target and source cost centres ******************************/

IF ("Approval_Status" == #MISSING)

       "Approval_Status" = 1;

ENDIF


    /*Take the Smartlist target cost centre, combine it with "HSP_ID_ , and set data entered at "no entity" to this*/

    @MEMBER(@CONCATENATE("HSP_ID_",@Name(@HspNumtoString("Target_Cost_Centre")))) = "No Entity";

    @MEMBER(@CONCATENATE("HSP_ID_",@Name(@HspNumtoString("Source_Cost_Centre")))) = "No Entity";


    /*Data which is at no entity level, display it in transfer in SL for Target, and Transfer out SL for Source*/

   @MEMBER(@CONCATENATE("HSP_ID_",@Name(@HspNumtoString("Target_Cost_Centre"))))->"Trans_In_Pending" = "No Entity"->"Transfer_Input";

    /*Data which is at no entity level, for transfer input intersection, set it to the smartlist value.*/

    @MEMBER(@CONCATENATE("HSP_ID_",@Name(@HspNumtoString("Source_Cost_Centre"))))->"Trans_Out_Pending" = ("No Entity"->"Transfer_Input")*-1;


    ELSEIF ("Submit_Status" == #missing)

"Approval Status" = #missing;

    @MEMBER(@CONCATENATE("HSP_ID_",@Name(@HspNumtoString("Target_Cost_Centre")))) = #missing;

    @MEMBER(@CONCATENATE("HSP_ID_",@Name(@HspNumtoString("Source_Cost_Centre")))) = #missing;



  ENDIF)

ENDFIX

Answers