Skip to Content
avatar image
Former Member

how to use date picker control in smartvfilter to filter a date field?

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>

datee.PNG (4.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Oct 26, 2015 at 08:26 AM
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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>

  • avatar image
    Former Member
    Oct 26, 2015 at 11:21 AM

    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>

    Add comment
    10|10000 characters needed characters exceeded

    • 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