How to filter date field as a user filter on record type?

Certified Associate Developer

Hi All,

I have a scenario where i need to filter the data from db based on the date. Filter values will be something like below.

Today

Yesterday

Last 7 days

FYI,

In Db,  date column is stored in date time format.

Can an someone suggest me how to achieve the filtering thing from db based on the date when db value is date time?

Thanks 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    a!localVariables(
      local!inputDate:"11/01/2022",
      local!numberOfDays:7,
    
      datetime(year(todate( local!inputDate)), month(todate( local!inputDate)), day(todate( local!inputDate)), 4) - local!numberOfDays
     )

    -  please create expression rule  with rule inputs  date and number of days (refer the above code and pass the date and number of days - ex: based on the selection if Yesterday then1 , if previous week then 7 ) and rule returns the datetime based on the values that  you send . The output value (the same date or datetime) can be passed as input to query entity to get the data from db. Hope this helps. Please let me know incase of any challenges.

Reply
  • 0
    Certified Senior Developer

    a!localVariables(
      local!inputDate:"11/01/2022",
      local!numberOfDays:7,
    
      datetime(year(todate( local!inputDate)), month(todate( local!inputDate)), day(todate( local!inputDate)), 4) - local!numberOfDays
     )

    -  please create expression rule  with rule inputs  date and number of days (refer the above code and pass the date and number of days - ex: based on the selection if Yesterday then1 , if previous week then 7 ) and rule returns the datetime based on the values that  you send . The output value (the same date or datetime) can be passed as input to query entity to get the data from db. Hope this helps. Please let me know incase of any challenges.

Children
No Data