I have this code in vba macro , need to convert in ti
For i = k To n
If k > incFreq Then
myPmt = myPmt * (1 + incRate)
k = 1
End If
discnt = discnt * (1 + discntRate)
escPV = escPV + myPmt / discnt
k = k + 1
Next
Having issue where it says i =k to n , they assign K again as 1 when its greater than incFreq and that should cause a loop .I am getting an endless loop when did using while becasue of K being reassigned ,
While(K<=noOfMonhts);
if(K>IncrementFrequency);
PaymentAmount=PaymentAmount*(1+EscalationRate);
K=1;
ENDIF;
discnt=discnt*(1+discountRate);
escpv=escpv+(PaymentAmount/discnt);
K=K+1;
END;
Is there something I am missing here while converting .
Need VBA Code to tm1 ti
-
- MVP
- Posts: 3240
- Joined: Mon Dec 29, 2008 6:26 pm
- OLAP Product: TM1, Jedox
- Version: PAL 2.1.5
- Excel Version: Microsoft 365
- Location: Brussels, Belgium
- Contact:
Re: Need VBA Code to tm1 ti
This would be the literal translation, not looking at the logic or what it does / is supposed to do:
Code: Select all
i = k;
While( i <= n );
If( k > incFreq );
myPmt = myPmt * (1 + incRate);
k = 1;
EndIf;
discnt = discnt * (1 + discntRate);
escPV = escPV + myPmt / discnt;
k = k + 1;
i = i + 1:
End;
Best regards,
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly