on 10-26-2015 7:48 AM
I have a date column in smarttable which I want to compare with user input date and filter based on User Input date<=Smart table date.Please help me with your inputs.Currently is shows as input field though am using a custom Date picker control.{see image below}.Thanks
Master.xml
<smartFilterBar:ControlConfiguration
key="MyDatetest"
index="4"
label="Valid From"
groupId="_BASIC"
width="300px"
>
<smartFilterBar:customControl>
<DatePicker
id="ValidtestFROM_DT"
valueFormat="MM/dd/yyyy" displayFormat="long"
width="15%"/>
</smartFilterBar:customControl>
</smartFilterBar:ControlConfiguration>
</smartFilterBar:controlConfiguration>
</smartFilterBar:SmartFilterBar>
Issue got fixed by using the below code in xml within smartfilter tags.However It does equal filter.Can anybody help me to do greater than or equal filter on the field.
<smartFilterBar:SmartFilterBar>
<smartFilterBar:ControlConfiguration
key="AGMT_ITM_END_DT"
label="Valid From"
index="3"
visible="true"
filtertype="single"
controlType="date"
groupId="_BASIC">
</smartFilterBar:SmartFilterBar>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To do GE, BT etc you have to do the following.
you have to annotate the odata as type date,which can be done in the model provider (MPC class, you have to implement in define method of MPC_EXT class) like this, Example:
fieldname Cdate must be of time Edm.Datetime:
Name of entity here is Head.
DATA(lo_entity_type) = model->get_entity_type( 'Head' ).
DATA(lo_prop) = lo_entity_type->get_property( 'Cdate' ).
DATA(lo_anno) = lo_prop->/iwbep/if_mgw_odata_annotatabl~create_annotation(
/iwbep/if_mgw_med_odata_types=>gc_sap_namespace ).
lo_anno->add( EXPORTING iv_key = 'display-format' iv_value
= 'Date' ).
Above coding is important, as you cannot set the object property to Date in the SEGW-Transaction.
in oData this field must be filterable.
So this field comes automatically as a real select-option in the filter (additional filter settings).
But be careful, as the field is then internally in the javascript not a date-object, it is a String in the format of a date (with the datevalue selected (time is always 00:00), but always the user time-zone). the strange thing than is that when you pass the filter to backend, sap internally converts it to UTC, so your date can have a other value then selected depending on your time-zone.
Example: User time Zone is GMT +01:00 . selected-date is January 20th. Format i than Jan 20 00:00 GMT+01:00 ....
When passing to backend this will be converted based on UTC, so you get a new Date 19th Jan 23:00 (as UTC is one hour befor) - so this result is not CORRECT!
for that i have a request at sap.
the only workaround we made is to convert the values of these filters before calling backend to have the corrected date in UTC - in my opinion a bug of sap.
Do unformat this, just read the filters and use converting date routines to have a corrected date-format that the later format from sap (when calling backend) uses correct time.
And besides all, the sapui is still very poor documented, especially the sap.ui.comp objects!!
hello
yes there is solution that smartfilterbar fields always use utc so that it will always work. n.b.: these is one version i guess 1.32.8 with that version there is still a bug, but versions onwards it works so you have to do the followin in the view: smaple
<smartfilterbar:SmartFilterBar afterVariantLoad="variantLoad" beforeVariantSave="variantSave" entityType="Head" id="smartFilterBar"
persistencyKey="Helpdesk" search="onSearchPressed" customData:dateFormatSettings='\{"UTC":true\}'>
this customData is important so here all datefields are interpreted as if this would be utc time date already
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vijay,Thanks.I have already tried using this but couldn't arrive at the expected result..I would appreciate if somebody can help me with code examples.
I used the below in my code
<Annotations
Target="shell.app.gsap.FH000_HM.FH006_DU.XS_APOLLO.AM.model.agreement.AI_AGMT_ITM_001Type/AGMT_END_DT"
xmlns="http://docs.oasis-open.org/odata/ns/edm">
<Annotation Term="com.sap.vocabularies.Common.v1.ValueList">
<Record>
<PropertyValue
Property="Label"
String="Valid from"
width="15%" />
<PropertyValue
Property="CollectionPath"
String="AGMT_END_DT " />
<PropertyValue
Property="SearchSupported"
Bool="false" />
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Edm.DateTime">
<PropertyValue
Property="LocalDataProperty" sap:display-format="Date"
PropertyPath="AGMT_END_DT" />
<PropertyValue
Property="ValueListProperty" sap:display-format="Date"
String="AGMT_END_DT" />
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.