Interface: NestedFilterDef

Oracle® JavaScript Extension Toolkit (JET)
16.0.0

F83701-01

Since:
  • 13.0.0
Module:
  • ojdataprovider

QuickNav

Fields

Description

Defines a kind of DataFilter.FilterDef which applies to the nested filter definitions.

NestedFilterDef allows another filter definition nested inside it. It supports multiple levels of nesting. When using nested filter through DataProvider to fetch data with multiple levels of details, it returns the top level matched rows along with all the details; it does not further filter the children in the returned results. Here is a sample usecase of NestedFilterDef:


Nested filter definition:
{op: '$exists', attribute: 'OrderLines', criterion:
  {op: '$exists', attribute: 'ProductDetails', criterion:
    {op: '$co', value: {ProductName: 'Tablet'}}
  }
}

Original dataset: [
   { FactoryId: 10, FactoryName: 'Rising Star Production', OrderLines: [
       { OrderId: 1001, ProductDetails: [
           { ProductId: 'P030', ProductName: 'Apple Magic Keyboard', Quantity: 1, UnitPrice: 40 },
           { ProductId: 'P040', ProductName: 'USB to USBC Convertor', Quantity: 3, UnitPrice: 20 }
         ], OrderDate: '01 Oct 2015'
       },
       { OrderId: 1005, ProductDetails: [
           { ProductId: 'P010', ProductName: 'iPad Tablet', Quantity: 1, UnitPrice: 500 },
           { ProductId: 'P021', ProductName: 'MacPro 15 Laptop', Quantity: 1, UnitPrice: 1600 }
         ], OrderDate: '10 Oct 2015'
       },
       { OrderId: 1002, ProductDetails: [
           { ProductId: 'P030', ProductName: 'Apple Magic Keyboard', Quantity: 1, UnitPrice: 40 },
           { ProductId: 'P033', ProductName: 'Dell Keyboard', Quantity: 1, UnitPrice: 30 },
           { ProductId: 'P077', ProductName: 'Fire Tablet', Quantity: 1, UnitPrice: 350 }
         ], OrderDate: '01 Oct 2019'
       }
     ]
   },
   { FactoryId: 30, FactoryName: 'NextGen Supplies', OrderLines: [
       { OrderId: 685, ProductDetails: [
           { ProductId: 'P023', ProductName: 'Dell Laptop', Quantity: 1, UnitPrice: 1530 },
           { ProductId: 'P077', ProductName: 'Dell Desktop', Quantity: 1, UnitPrice: 1800 }
         ], OrderDate: '01 Aug 2021'
       }
     ]
   }
 ]

Filtered dataset: [
   { FactoryId: 10, FactoryName: 'Rising Star Production', OrderLines: [
       { OrderId: 1001, ProductDetails: [
           { ProductId: 'P030', ProductName: 'Apple Magic Keyboard', Quantity: 1, UnitPrice: 40 },
           { ProductId: 'P040', ProductName: 'USB to USBC Convertor', Quantity: 3, UnitPrice: 20 }
         ], OrderDate: '01 Oct 2015'
       },
       { OrderId: 1005, ProductDetails: [
           { ProductId: 'P010', ProductName: 'iPad Tablet', Quantity: 1, UnitPrice: 500 },
           { ProductId: 'P021', ProductName: 'MacPro 15 Laptop', Quantity: 1, UnitPrice: 1600 }
         ], OrderDate: '10 Oct 2015'
       },
       { OrderId: 1002, ProductDetails: [
           { ProductId: 'P030', ProductName: 'Apple Magic Keyboard', Quantity: 1, UnitPrice: 40 },
           { ProductId: 'P033', ProductName: 'Dell Keyboard', Quantity: 1, UnitPrice: 30 },
           { ProductId: 'P077', ProductName: 'Fire Tablet', Quantity: 1, UnitPrice: 350 }
         ], OrderDate: '01 Oct 2019'
       }
     ]
   }
]


Usage

Signature:

interface NestedFilterDef<D>

Generic Parameters
ParameterDescription
DType of Data for the filter definition. See below for examples.
Typescript Import Format
//To use this interface, import as below.
import {NestedFilterDef} from "ojs/ojdataprovider";

For additional information visit:


Examples

Nested filter definition on 'ProductDetails' field with nested criterion:

  • Attribute filter definition on 'ProductName' subfield containing the phrase 'Tablet'

{op: '$exists', attribute: 'ProductDetails', criterion:
  {op: '$co', value: {ProductName: 'Tablet'}}
}

Nested filter definition on 'ProductDetails' field with nested criterion:

  • Extended compound filter combining the following two criteria with '$or' operator:
    • Attribute filter definition on 'ProductName' subfield containing the phrase 'Tablet'
    • Attribute filter definition on 'ProductName' subfield ending with the phrase 'desktop' case insensitive

{op: '$exists', attribute: 'ProductDetails', criterion:
  {op: '$or', criteria:
    {op: '$co', value: {ProductName: 'Tablet'}},
    {op: '$ew', value: {ProductName: 'desktop'}, collationOptions: {sensitivity: 'accent'}}
  }
}

Nested filter definition on 'OrderLines' field with nested criterion:

  • Nested filter definition on 'OrderDetails' subfield with nested criterion:
    • Attribute filter definition on 'ProductName' sub-subfield starting with the phrase 'USB'

{op: '$exists', attribute: 'OrderLines', criterion:
  {op: '$exists', attribute: 'ProductDetails', criterion:
    {op: '$sw', value: {ProductName: 'USB'}}
  }
}

Fields

(static) NestedOperator :string

NestedOperator enum
Properties:
Name Type Default Description
$exists string $exists The filter is a potential match if the attribute exists and the criterion matches; the filter is not a match if the attribute does not exist.
Since:
  • 13.0.0

attribute :AttributeFilterDef.AttributeExpression|string

Property which contains an expression specifies which attribute to filter on.
Since:
  • 13.0.0

criterion :(AttributeFilterDef.<D>|AttributeExprFilterDef.<D>|ExtendedCompoundFilterDef.<D>|NestedFilterDef.<D>)

Types of FilterDefs which can be nested inside the NestedFilterDef applying on the attribute. The following types are supported:
  • AttributeFilterDef
  • AttributeExprFilterDef
  • ExtendedCompoundFilterDef
  • NestedFilterDef
Since:
  • 13.0.0

op :NestedFilterDef.NestedOperator

Operator to apply for the filter. Valid operator defined in the NestedFilterOperator is the string:
  • $exists If the attribute exists, there is a potential match if criterion matches. If the attribute does not exist or is invalid, there is no match.
Since:
  • 13.0.0