Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-11084

Add support for searching for date range in LiveTable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 8.4
    • Fix Version/s: 9.5-rc-1
    • Component/s: LiveTable
    • Labels:
      None
    • Difficulty:
      Easy
    • Similar issues:

      Description

      Currently XWiki LiveTable component allows to search only for particular date match in form yyyy-MM-dd.
      I suggest to add feature to search for date ranges if ..._from and ..._to date fields in object class is used. To support this you need to add some kind of following code in XWiki.LiveTableResultsMacros code:

      Around line 541:
      ...
        #elseif($propType == 'DateClass')
          #set($fromSql = "${fromSql}, DateProperty ${safe_tableAlias}")
          #if($colname.indexOf("_from")>0)
           #set($convtodate=true)
           #set($whereSql = "${whereSql} and obj.id=${safe_tableAlias}.id.id and ${safe_tableAlias}.id.name = ? and ${safe_tableAlias}.value >= ?")
          #elseif($colname.indexOf("_to")>0)
           #set($convtodate=true)
           #set($whereSql = "${whereSql} and obj.id=${safe_tableAlias}.id.id and ${safe_tableAlias}.id.name = ? and ${safe_tableAlias}.value <= ?")
          #else
           #set($convtodate=false)
           #set($whereSql = "${whereSql} and obj.id=${safe_tableAlias}.id.id and ${safe_tableAlias}.id.name = ? and upper(str(${safe_tableAlias}.value)) like upper(?)")
          #end
          #if($convtodate)
           #set($wheredate=$datetool.toDate("yyyy-MM-dd",$filterValue))
           #set($discard = $whereParams.addAll(["${colname}", $wheredate]))
          #else
           #set($discard = $whereParams.addAll(["${colname}", "${filterValue}%"]))
          #end
        #elseif($propType == 'TextAreaClass' || $propType == 'UsersClass' || $propType == 'GroupsClass')
      ...
      

      And also update http://extensions.xwiki.org/xwiki/bin/view/Extension/Livetable+Macro and http://platform.xwiki.org/xwiki/bin/view/DevGuide/LiveTable guides.

        Attachments

          Activity

            People

            • Assignee:
              pbondoer Pierre Bondoerffer
              Reporter:
              valdisvi Valdis Vitolins
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Date of First Response: