2 Replies Latest reply: Nov 21, 2012 1:48 PM by 182990 RSS

    Requirement with Range Filter

    182990
      Hi all,

      I have a requirement in which I should create a Range Filter for a Date attribute in the following way:

      RangeOperator: BTWN
      Value1: SYSDATE - 90
      Value2: SYSDATE

      However, I couldn't find a way to get the sysdate and calculate a different time over it. Currently my data source definition is like below:

      {
      "baseFunctions": [{
      "attributeKey": "ISH_SHIP_DATE",
      "class": "com.endeca.portal.data.functions.RangeFilter",
      "rangeOperator": "BTWN",
      "rangeType": "DATE",
      "value1": "2012-01-01T14:00:00.000Z",
      "value2": "2012-12-01T14:00:00.000Z"
      }],
      "datastoreName": "lcm",
      "name": "lcm-mn",
      "port": "7770",
      "server": "localhost"
      }

      Is there any way to achieve the requirement of getting sysdate on RangeFilter and calculate some time over it?

      I'd appreciate any comment and help on this.

      Thanks,
      Eduardo
        • 1. Re: Requirement with Range Filter
          Dan at Branchbird
          Eduardo,

          If you have the luxury of re-ingesting all of your data nightly, you could leverage an ingest design pattern like this (https://wikis.oracle.com/display/endecainformationdiscovery/Derived+Datetime-based+Attribution) to produce a "DaysAgo" attribute. From this point, you could then write your range filter syntax to pull records LT 90 days.

          E.g.

          {
          "baseFunctions": [{
          "attributeKey": "DaysAgo",
          "class": "com.endeca.portal.data.functions.RangeFilter",
          "rangeOperator": "LT",
          "rangeType": "NUMERIC",
          "value1": "90"
          }],
          "datastoreName": "lcm",
          "name": "lcm-mn",
          "port": "7770",
          "server": "localhost"
          }

          If you don't have this luxury, you could write a custom QueryFunction leveraging the EID product SDK. Check out Chapter 5 from the Studio Developer's Guide to learn more about leveraging the SDK to create your own variety of the RangeFilter QueryFunction. http://docs.oracle.com/cd/E29805_01/studio.230/StudioDevGuide.pdf

          E.g.

          {
          "baseFunctions": [{
          "attributeKey": "ISH_SHIP_DATE",
          "class": "com.branchbird.oeid.data.functions.BranchbirdRangeFilter",
          "rangeOperator": "AGO",
          "rangeType": "DAYS",
          "value1": "90"
          }],
          "datastoreName": "lcm",
          "name": "lcm-mn",
          "port": "7770",
          "server": "localhost"
          }


          Hope that helps,
          Dan
          http://branchbird.com

          Edited by: Dan at Branchbird on Nov 21, 2012 11:38 AM

          Edited by: Dan at Branchbird on Nov 21, 2012 11:38 AM
          • 2. Re: Requirement with Range Filter
            182990
            Hi Dan,

            Thanks a lot for the suggestion. I ended up by implementing this requirement with Deep Link feature. This way I calculate in Java code the SYSDATE-90 and set the deep link dynamically. In my case, I have an OAF page that holds the Endeca, then I created a controller class that creates and set the deep link parameter in runtime.

            Thanks,

            Eduardo