I am very new to TM1 and I need some urgent assistance with an 'IF' statement in a TI Process.
Basically....
I have a cube that contains a kilometer reading per trip, per team, per region. Lets say the data looks like this:
Region A, Team 1, km.
I want to accumulate the km, per Team, per Region. If that Accumulated km is > 6250, then I use Rate 2 to calc the cost for the disctance over 6250.
If the Accumulated Cost is not more than 6250, I use Rate 1 to calc the cost for under 6250.
I am not sure how to do this. I was thinking (this come from days gone by Cobol Syntax...) I would use a variable vRegion and vTeam. Everytime I "read" the cube, I would check
Code: Select all
if Region is still = vRegion and Team is still = vTeam. (same team same Region)
Accumkm = Accumkm + km.
If Accumkm > 6250 then
Difference = Accumkm - 6250
Cost = Difference * Rate 2
Else
Cost = Km * Rate 1
endif
Else
vRegion = Region
vTeam = Team
Endif
My Questions are...
1. I need help with the syntax of the "IF" Statement.
2. Help me understand pls...in the TI Code...does all the code get excecuted for every 'line' read in the cube?
3. If I need to initiate a variable once and once only - where do I do that?
4. If I need to initiate a variable for every read, do I just put that in the top of the TI Process?
ANY help will be appreciated thanx!