Forum Discussion

RandyThompson's avatar
RandyThompson
New Contributor III
6 days ago

Use api.Data.Calculate to move data between 2 cubes

Is it possible to copy a value from one cube to another mutually exclusive cube with a Custom Calculate business rule? I am trying to copy a value from the Cb#Financial cube to the Cb#CASH cube.  How...
  • pranav46's avatar
    4 days ago
    		#region Pull Cashflow from Financial
    		private void Cash_Pull_from_Financial(SessionInfo si, FinanceRulesApi api)
    		{
    			//Simple Data Pull
    			DataBuffer sourceDB = new DataBuffer();
    			sourceDB = api.Data.GetDataBufferUsingFormula("cb#Financial:S#ACTUAL:C#Local:F#None:O#Forms:A#SourceAccount:UD2#None:U4#None:UD5#None:U6#None:UD7#None:U8#None");
    			api.Data.FormulaVariables.SetDataBufferVariable("srcFinancial", sourceDB, true);
    				
    			api.Data.ClearCalculatedData("F#None:O#Forms:A#RateAccount:UD2#None:U4#None:UD5#None:U6#None:UD7#None:U8#None", true, true, true, true);
    			api.Data.Calculate("F#None:O#Forms:A#targetAccount:UD2#None:U4#None:UD5#None:U6#None:UD7#None:U8#None = RemoveZeros($srcFinancial)",null,null,null,null,"UD1#Product.Base",null,"UD3#Location.Base",null,null,null,null,null,null,true);
    		}
    		#endregion

    Try this and run against Target cube from DM.