Can MultiplyUnbalanced function take more than 2 components
Hello OneStream experts:
Thank you for the helps in the past. I found this forum is very helpful.
I feel the MultiplyUnbalanced function is very nice and wonder if it can take more than 2 components to multiply. They give an example:
If I want to do
A#UnbalancedMultiplication=A#60000 x A#41000:U2#Parts I can use the following:
api.Data.Calculate("A#UnbalancedMultiplication = MultiplyUnbalanced(A#60000, A#41000:U2#Parts, U2#Parts)")
But, if I want to do multiply three components
A#UnbalancedMultiplication=A#60000 x A#41000:U2#Parts x A#51000:U2#Material
how to use the MultiplyUnbalanced function?
Thank you in advance for any answers.
All buffer functions, including the regular operators, only work with two buffer at a time. You can either nest the function , or use an intermediate buffer.
Nesting (a bit hard to read but simple enough to write):
api.data.calculate("A#Unbalanced = MultiplyUnbalanced(MultiplyUnbalanced(A#60000, A#410000:U2#Parts, U2#Parts), A#41000:U2#Materials, U2#Materials)")
Intermediate buffer (more code but the buffer could potentially be reused):
Dim intermediate as DataBuffer = api.Data.GetDataBufferUsingFormula("MultiplyUnbalanced(A#60000,A#41000:U2#Parts, U2#Parts)") api.Data.FormulaVariables.SetDataBufferVariable("parts", intermediate, False) api.Data.Calculate("A#Unbalanced = MultiplyUnbalanced($parts, A#41000:U2#Materials, U2#Materials)")