Assign Dim Element - Based on Date Range
Posted: Fri Jan 21, 2011 6:37 pm
Proposed Solution - Use a Cube to Store Window Attributes
The Source file does not have the VodWindow or the VodEntity, so as I load a file, I want to assign the VodWindow and the WindowEntity based on the Transaction date on the source file to a variable and then insert this record with its two new columns to a cube named VodDailySnapshots.
If the Transaction Date is between the WindowStartDate and the WindowEndDate for a given VodTitle, I should be able to get the VodWindow and VodEntity.
For each VodTitle, only one record will exist in the VodTitleWindowCube for a given date range. - Classic for example.
On the source file, I will know the Transaction date and the VodTitle (SF00001). I want to assign the VodWindow to a Variable and the WindowEntity to a variable, so that I can put these values in a cube.
Current Solution - Use Dimension Aliases
I have one working solution.
In the VodTitles dimesion:
Added one Attribute for the VodEntity.
#^^^ Get the Entity for the Vod Title. One Entity is asociated with each SF code.
sEntityCode = TRIM(CELLGETS ('}ElementAttributes_VodTitles', sSFCode, 'CurrentVodEntity'));
Added one Attribute (a start date) for each of the 3 Windows shown above. In a Ti Process I fetch the 3 assigned start dates to variables
nPreTheatricalWindowStartDateSerial = DAYNO(CELLGETS ('}ElementAttributes_VodTitles', sSFCode, 'PreTheatricalStartDate'));
nPremierWindowStartDateSerial = DAYNO(CELLGETS ('}ElementAttributes_VodTitles', sSFCode, 'PremierStartDate'));
nClassicWindowStartDateSerial = DAYNO(CELLGETS ('}ElementAttributes_VodTitles', sSFCode, 'ClassicStartDate'));
As the data is loaded the transaction date is compared to the Attribute dates and a Window is assigned.
#^^^ Get the Window for the the SFCode.
If (l_OrderDateSerial <= nPreTheatricalWindowStartDateSerial);
sWindow = 'PreTheatrical';
ElseIf ((l_OrderDateSerial > nPreTheatricalWindowStartDateSerial) & (l_OrderDateSerial < nClassicWindowStartDateSerial));
sWindow = 'Premier';
ElseIf(l_OrderDateSerial >= nClassicWindowStartDateSerial);
sWindow = 'Classic';
Else;
ItemReject('Window can not be assigned');
EndIf;
Insert the data to the Cube
#^^^ Load the Transaction 'View' Count - FOD is Free on Demand
IF (v_content_type @<> 'FOD');
iCurrVal = CELLGETN (cubRef1, sOrderDay, sEntityCode, v_operator_no, v_cable_system_no, sSFCode, sFormat, sWindow, sBalType, 'Buys');
CELLPUTN (iCurrVal+ v_transactions, cubRef1, sOrderDay, sEntityCode, v_operator_no, v_cable_system_no, sSFCode, v_sd_hd, sWindow, sBalType, '
Buys');
ENDIF
Although this works, I was informed that that there will be many Windows added in the future. The way I have it set up, evey time a Window is added, I would have to 1) Add a new Attribute for the StartDate for the new Window and 2) modify the Ti Process code. I don't think that this is the best solution.
If I keep track of the Window attributes using a cube then as soon as a new Window is added to the VodWindow dim It will be available in the cube. The user would have to add the WindowStart and WindowEnd date ranges and the Ti Code would not have to be modified.
Would appreciate some help in determining how/if this can be accomplished.
Thanks,
Walt