Hi,
I have nested repeats with the upper repeat being “years” and the nested one being “accounts”. I now need to transfer a value from the year before to the present year and only between accounts of the same type. I tried a computation with currentRepetition which looks like this:
but it did not work.
I only managed to make it work with a seperate computation for every Accounttype.
Is there a way with which i can check if the account type in my current repetition is the same as the previous repetition and only get the value from the repetitions with matching account types without making a computation for each account type?
Hi @konstantin-rugged-stone
Yes, there is a way to
You have already used the $-operator correctly to point to the current repetition in the filter condition when you modeled:
Having CurrentRepetition(Years) == {CurrentRepetition($Years)-1}
As mentioned in the Documentation, the $-operator fixes this value to the current repetition. You just need to do the same again for the other level and point to a specific repetition of Accounts.
Your original rule wasn’t working because the second condition with the AccountType always pointed to the same index and did not iterate.
I would expect something like this to work
MaxValue(Years*/Accounts*/MonetaryValue Having
CurrentRepetition(Years) == {CurrentRepetition($Years)-1} AND
[Years/Accounts/AccountType] == [Years/$Accounts/AccountType])
I will raise a bug ticket, A12-17055, as the Parser throws an error. The workaround is to put the rule in the repeatable Group:
MaxValue(../../Years*/Accounts*/MonetaryValue Having
CurrentRepetition(..) == {CurrentRepetition($..)-1} AND
[AccountType] == [$AccountType])
test_DM.json (9.2 KB)