cancel
Showing results for 
Search instead for 
Did you mean: 

Change SmartFilterBar input from Multi to Single Value

andrefernandes
Participant

We are developing an ALP app in WebIDE which consumes xsodata. We want one of the filters on the Smart Filter Bar to only accept a single value instead of multiples. The Smart Filter Bar is automatically rendered by the annotations based on the metadata, however we are unable to add the v2 annotation sap:filter-restriction="single-value" which supposedly controls this area.

Upon checking the SmartFilterBar control on the API Reference (https://sapui5.netweaver.ondemand.com/sdk/#/api/sap.ui.comp.smartfilterbar.SmartFilterBar/annotations/FilterExpressionType), I saw that we could add the v4 annotation com.sap.vocabularies.Common.v1.FilterExpressionRestriction to the annotations on the app and set AllowedExpressions to SingleValue. However, I couldn't find that annotation on the Annotation Modeler. Additionally, when checking the content of the Vocabulary (https://wiki.scn.sap.com/wiki/display/EmTech/OData+4.0+Vocabularies+-+SAP+Common#FilterExpressionRestrictionType), I noticed that the annotation FilterExpressionRestriction suggested by the API Reference is actually deprecated, being replaced by Capabilities.FilterRestrictions. But this Vocabulary doesn't mention anything about single/multi values (https://www.odata.org/blog/introducing-a-capabilities-vocabulary/).

Could someone shed some light on how I can set a single field on the filter to allow only a single value?

Best regards,

André

former_member542756
Discoverer

Maybe thomas.jung can help?

View Entire Topic
0 Kudos

Tried using annotations and faced the same problem. it seems they do not work as described by the documentation. see below for DisplayView

		
				<Annotation Term="Org.OData.Capabilities.V1.FilterRestrictions">
					<Record>
						<PropertyValue Property="FilterExpressionRestrictions">
							<Collection>
								<Record>
									<PropertyValue Property="Property" PropertyPath="DisplayView"/>
									<PropertyValue Property="AllowedExpressions" String="SingleValue"/>
								</Record>
							</Collection>
						</PropertyValue>
					</Record>
				</Annotation>

I will use the workaround by creating a custom Value help via the smartfilterbars custom control. Maybe others facing this issue can do the same.