Skip to Content
0

How to display percentage in list card - bar flavor in Fiori Overview Page

Oct 26, 2017 at 10:13 AM

70

avatar image
Former Member

How to display percentage in list card - bar flavor in Fiori Overview page like this:

there is lines of code in AnnotationHelper.js:

sap.ovp.cards.AnnotationHelper.isFirstDataPointPercentageUnit = function(iContext, aCollection) {
		var oDataPoint = getSortedDataPoints(iContext, aCollection)[0];


		if (oDataPoint && oDataPoint.Value && oDataPoint.Value.Path) {
			var sEntityTypePath = iContext.getPath().substr(0, iContext.getPath().lastIndexOf("/") + 1);
			var oModel = iContext.getModel();
			var oEntityType = oModel.getProperty(sEntityTypePath);
			var oProperty = oModel.getODataProperty(oEntityType, oDataPoint.Value.Path);
			if (oProperty && oProperty["Org.OData.Measures.V1.Unit"]) {
				return oProperty["Org.OData.Measures.V1.Unit"].String === "%";
			}
		}
		return false;
	};

Seems it determines the "Org.OData.Measures.V1.Unit" then set the Min and Max value of the bar. But how can I set the Unit property of the data field in odata metadata.xml?

Or if there is another way to make the datapoint as a percentage value?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

avatar image
Former Member
Oct 26, 2017 at 11:16 AM
0

After investigation, should add unit annotations to specific data column:

<Annotations Target="NAME_SPACE.ENTITY_TYPE/PROPERTY_NAME">
    <Annotation Term="Org.OData.Measures.V1.Unit" String="%"/>
</Annotations>
Share
10 |10000 characters needed characters left characters exceeded