cancel
Showing results for 
Search instead for 
Did you mean: 

Fiori elements default filter with SelectionVariant not working

In my fiori elements list report app I am using the following annotation to add a filter lbkum !== 0 as a de fault value. It is not working:

<Annotations Target="SAP.EntitySet">
	<Annotation Term="UI.SelectionVariant">
		<Record>
			<PropertyValue Property="SelectOptions">
				<Collection>
					<Record Type="UI.SelectOptionType">
						<PropertyValue Property="Ranges">
							<Collection>
								<Record Type="UI.SelectionRangeType">
									<PropertyValue Property="Option" EnumMember="UI.SelectionRangeOptionType/NE"/>
									<PropertyValue Property="Low" Decimal="0.000"/>
									<PropertyValue Property="Sign" EnumMember="UI.SelectionRangeSignType/I"/>
								</Record>
							</Collection>
						</PropertyValue>
						<PropertyValue Property="PropertyName" PropertyPath="lbkum"/>
					</Record>
				</Collection>
			</PropertyValue>
		</Record>
	</Annotation>
</Annotations><br>

When I use the following annotations to set a default filter value salk3 === 0, it works:

<Annotations Target="SAP.EntitySet/lbkum"><br>	<Annotation Term="Common.FilterDefaultValue" Decimal="0.000"/>
</Annotations><br>

I am developing this on Business Application studio. Do I need to deploy this to a proper launchpad to see the default filter? What is missing here?

Thanks.

junwu
Active Contributor
0 Kudos

what's the version of your ui5?

0 Kudos

I am on version 1.96.1

View Entire Topic
leonikussmaul
Product and Topic Expert
Product and Topic Expert

From what I can see, this should work. You do not need to deploy it to the launchpad in order to see the annotations. Try the below steps

1. Check the name of your entity set, make sure it is the specified Target attribute

2. Check the name of the property, make sure the PropertyPath specifies in the PropertyName attribute is correct

3. Check the data type - make sure the Decimal attribute matches the data type of the property

4. Check if there are any other annotations overriding the default filter

If none of the above works, you can debug the issue by checking the metadata of the service using the below URL to see if the annotations are correctly applied.

/{serivceRoot}/$metadata 
0 Kudos

Hello,

Thanks for the reply.

The annotations were added using the guided development generator in BAS to the local annotations.xml file, and the entity, the name of the property and the type are all correct, as checked in the metadata file. There are no annotations other than the following:

<Annotations Target="ServiceName.EntitySet">
	<Annotation Term="UI.LineItem">
		<Collection>
			...
			<Record Type="UI.DataField">
				<PropertyValue Property="Value" Path="lbkum"/>
			</Record>
			<Record Type="UI.DataField">
				<PropertyValue Property="Value" Path="salk3"/>
			</Record>
			...
		</Collection>
	</Annotation>
	<Annotation Term="UI.SelectionFields">
		<Collection>
			...
			<PropertyPath>lbkum</PropertyPath>
			...
		</Collection>
	</Annotation>
</Annotations>

When I debugged in javascript, particularly in the MetadataAnalyzer.js file, I found that the annotation is indeed being recognized, it's just not being taken into account. Here is (part of ) the return of the function _getEntityDefinition of the mentioned class:

I am out of ideas..
Thanks gain for any help.

leonikussmaul
Product and Topic Expert
Product and Topic Expert
0 Kudos

Are you able to add the annotation directly via CDS, by any chance?

0 Kudos

It is unfortunately not supported according to the documentation:

https://sapui5.hana.ondemand.com/sdk/#/topic/f27ad7bc1f9c4b0d947b1fb18c37e94c.html

igor_muntoreanu
Explorer
0 Kudos

Hi Oussama,

did you find a solution here or a workaround? We are facing the same problem in our project.

Thank you