Customized Number Formatting
By using the NumberFormat element, you can set minimum and/or maximum fraction digits for a Data Measure. You just need to add <NumberFormat minimumFractionDigits="1" maximumFractionDigits="2"/> element within your <DM> element.
<
TLVList
xmlns
=
"http://www.onenetwork.com/Platform"
>
<
TLV
>
<
Name
>CustomizedNumberFormattingOnDM</
Name
>
<
Description
>Example of Customized Number Formatting On DM </
Description
>
<
Bucketization
>DAILY</
Bucketization
>
<
BucketsPerPage
>7</
BucketsPerPage
>
<
SqlDef
Name
=
"DummySql"
GroupName
=
"TLVs"
>
<![CDATA[
SELECT the_date, quantity, sys_book_id FROM(
SELECT TO_DATE('2012-07-15','YYYY-MM-DD') the_date , 1.34234 quantity, 10000 sys_book_id FROM dual UNION ALL
SELECT TO_DATE('2012-07-16','YYYY-MM-DD') the_date , 5 quantity, 10000 sys_book_id FROM dual UNION ALL
SELECT TO_DATE('2012-07-17','YYYY-MM-DD') the_date , 4.84456 quantity, 10000 sys_book_id FROM dual UNION ALL
SELECT TO_DATE('2012-07-18','YYYY-MM-DD') the_date , 10.4563 quantity, 10000 sys_book_id FROM dual UNION ALL
SELECT TO_DATE('2012-07-19','YYYY-MM-DD') the_date , 10.7892 quantity, 10000 sys_book_id FROM dual UNION ALL
SELECT TO_DATE('2012-07-20','YYYY-MM-DD') the_date , 4.123 quantity, 10000 sys_book_id FROM dual UNION ALL
SELECT TO_DATE('2012-07-21','YYYY-MM-DD') the_date , 20.5647 quantity, 10000 sys_book_id FROM dual)
]]>
</
SqlDef
>
<
Filters
bindSqlNulls
=
"true"
>
<
CustomFilterField
>
<
FieldRef
category
=
"PDF"
levelType
=
"Undefined"
>
<
FieldName
>DateRange</
FieldName
>
</
FieldRef
>
<
Hidden
>false</
Hidden
>
<
Editable
>true</
Editable
>
<
Type
>DATE_RANGE</
Type
>
<
Optional
>true</
Optional
>
<
DateRangeMapping
fromSqlName
=
"DATE_RANGE_START"
toSqlName
=
"DATE_RANGE_END"
/>
</
CustomFilterField
>
<
DateRange
start
=
"$NULL$"
end
=
"$NULL$"
/>
</
Filters
>
<
ColumnHierarchy
/>
<
DM
bucketization
=
"DAILY"
>
<
Name
>Request qty</
Name
>
<
DisplayName
>Request qty</
DisplayName
>
<
UOM
>NONE</
UOM
>
<
UnsetDisplayValue
>Blank</
UnsetDisplayValue
>
<
NumberFormat
minimumFractionDigits
=
"1"
maximumFractionDigits
=
"2"
/>
<
LevelType
>ZBKS.Book</
LevelType
>
<
CustomTypeName
>Standard ZBKS.Book</
CustomTypeName
>
<
SqlDefName
>DummySql</
SqlDefName
>
<
SqlQuantityField
levelType
=
"Undefined"
>
<
FieldName
>quantity</
FieldName
>
</
SqlQuantityField
>
<
SqlDateField
levelType
=
"Undefined"
>
<
FieldName
>the_date</
FieldName
>
</
SqlDateField
>
</
DM
>
</
TLV
>
</
TLVList
>
After execution of the example above you should be able to see output as follow:
Observe that values in the buckets are formatted. For example, the actual output for date 7/15 is 1.34234 but as we set maximum fraction digit = 2, it displays as 1.34.