Page 1 of 1

Replace hard coded rule values with cube value

Posted: Wed Aug 29, 2018 11:34 am
by Mark RMBC
Hi all,

I have a task to make a model more dynamic, as there are literal values in some rules. For example how far the rules project into the future years is a literal value of 4.

So an example of a current rule and feeder is as follows

Rule:

Code: Select all

['AppHrs'] = N:
	DB(If(Numbr(!Year) > DB('Admin_Cube', 'General', 'CurrentYrN') & Numbr(!Year) < DB('Admin_Cube', 'General', 'CurrentYrN')+4,
		'StaffingCube',stet),
           !Employee, !JobNumber, !CostCentre, !Detail, attrs('Year',!Year,'PrevYear'), !Versions, 'AppHrs');
Feeder:

Code: Select all

[' AppHrs '] =>
	DB(If((Numbr(!Year) >= DB('Admin_Cube', 'General', 'CurrentYrN') & Numbr(!Year) < DB('Admin_Cube', 'General', 'CurrentYrN')+3) &
	DB('StaffingCube', !Employee, !JobNumber, !CostCentre, !Detail, !Year, !Versions, 'ActiveProject') @<> 'No',
		'StaffingCube',stet),
           !Employee, !JobNumber, !CostCentre, !Detail, attrs('Year',!Year,'NextYear'), !Versions, 'AppHrs');
The proposed changes are:

Rule:

Code: Select all

[' AppHrs '] = N:

	DB(If(Numbr(!Year) > DB('Admin_Cube', 'General', 'CurrentYrN') & Numbr(!Year) <= DB('Admin_Cube', 'General', 'CurrentYrN') + DB('Admin_Cube', 'MTFS', 'FutureYearsCount'),
		''StaffingCube',stet),
           !Employee, !JobNumber, !CostCentre, !Detail, attrs('Year',!Year,'PrevYear'), !Versions, 'AppHrs');
Feeder:

Code: Select all

[' AppHrs '] =>

	DB(If((Numbr(!Year) >= DB('Admin_Cube', 'General', 'CurrentYrN') & Numbr(!Year) < DB('Admin_Cube', 'General', 'CurrentYrN') + DB('Admin_Cube', 'MTFS', 'FutureYearsCount')) &
	DB('StaffingCube', !Employee, !JobNumber, !CostCentre, !Detail, !Year, !Versions, ' ActiveProject ') @<> 'No',
		'StaffingCube',stet),
           !Employee, !JobNumber, !CostCentre, !Detail, attrs('Year',!Year,'NextYear'), !Versions, 'AppHrs');
So basically the literal value 4 has been replaced by a lookup to cube intersection, DB('Admin_Cube', 'MTFS', 'FutureYearsCount').

So if the client ever wanted to project 5 years into the future and not 4 they would update the admin cube, rather than a need to update all the rules.

Can anyone point to any pitfalls with this approach or things that need to be taken into account?

Cheers, Mark

Re: Replace hard coded rule values with cube value

Posted: Wed Aug 29, 2018 4:54 pm
by jim wood
When your lookup changes you'll need to re-compile your feeders. Unless something has changed that's always been the case variable feeders.

Re: Replace hard coded rule values with cube value

Posted: Thu Aug 30, 2018 10:39 am
by Mark RMBC
Hi Jim,

Really appreciate the response, thanks.

There are already TI processes that re-compile the feeders via CubeProcessFeeders, so I think that issue is covered Also the servers are shut down and restarted once a week.

cheers, Mark