DMRef
Sometimes, the same DataMeasure can be used across several different TLVs. Instead of copy/pasting the DM in multiple TLVs, you should define your reusable DMs in a separate file with the extension ".dms". This file should reside in the tlvs/ directory. You can then reference these from multiple TLVs using the DMRef element.
Sample .dms file
<TLVDataMeasures xmlns="http://www.onenetwork.com/Platform"><SqlDef Name="DummySql" GroupName="TLVs"><![CDATA[ SELECT the_date, quantity, sys_book_id FROM( SELECT TO_DATE('2011-07-01','YYYY-MM-DD') the_date , 1 quantity, 10000 sys_book_id FROM dual UNION ALL SELECT TO_DATE('2011-07-02','YYYY-MM-DD') the_date , 5 quantity, 10000 sys_book_id FROM dual UNION ALL SELECT TO_DATE('2011-07-03','YYYY-MM-DD') the_date , 4 quantity, 10000 sys_book_id FROM dual UNION ALL SELECT TO_DATE('2011-07-04','YYYY-MM-DD') the_date , 10 quantity, 10000 sys_book_id FROM dual UNION ALL SELECT TO_DATE('2011-07-05','YYYY-MM-DD') the_date , 10 quantity, 10000 sys_book_id FROM dual UNION ALL SELECT TO_DATE('2011-07-07','YYYY-MM-DD') the_date , 4 quantity, 10000 sys_book_id FROM dual UNION ALL SELECT TO_DATE('2011-07-08','YYYY-MM-DD') the_date , 20 quantity, 10000 sys_book_id FROM dual) ]]></SqlDef> <DM bucketization="DAILY"> <Name>RequestQuantity</Name> <DisplayName>Request Quantity</DisplayName> <SqlDefName>DummySql</SqlDefName> <SqlQuantityField levelType="Undefined"> <FieldName>quantity</FieldName> </SqlQuantityField> <SqlDateField levelType="Undefined"> <FieldName>the_date</FieldName> </SqlDateField> </DM></TLVDataMeasures> (To deploy the ".dms" file without restarting the Platform Server, call "ant deploy-dms" ant target from module directory. On deploy of dms file, TLV files also get reloaded to reference the correct DM.)
To use a DM from a .dms file in your TLV definition, define a DMRef element that takes the DM name with module prefix. For example:
<TLVList xmlns="http://www.onenetwork.com/Platform"> <TLV> <Name>MyFirstTLV</Name> <Description>My First TLV Report Example</Description> <Bucketization>DAILY</Bucketization> <BucketsPerPage>7</BucketsPerPage> <Filters bindSqlNulls="true"> <CustomFilterField> <FieldRef category="PDF" levelType="Undefined"> <FieldName>DateRange</FieldName> </FieldRef> <Hidden>false</Hidden> <Editable>true</Editable> <Type>DATE_RANGE</Type> <Optional>false</Optional> <DateRangeMapping fromSqlName="DATE_RANGE_START" toSqlName="DATE_RANGE_END"/> </CustomFilterField> <DateRange start="$NULL$" end="$NULL$"/> </Filters> <DMRef>ZBKS.RequestQuantity</DMRef> </TLV></TLVList>