CombinedIndex
  • 1 Minute to read
  • Dark
    Light
  • PDF

CombinedIndex

  • Dark
    Light
  • PDF

Article summary

General: CombinedIndex

Create a new discrete integer field by multiplexing the unique values for fields 1 up to 6.

All unique Value|value… combinations for the source fields are combined as strings and then the resulting values are assigned a unique integer.

This creates a numerical field from 1 to N where N is the number of unique value|value… combinations from the combined source fields (sometimes referred to as the dimensional space).

Purpose

Use this function to:
  • Build unique keys for creating joins
  • Enumerate value|value combinations across multiple fields
  • Calculate dimensional space for multiple fields

Return Value

PropertyValue
FieldTypeInteger
FieldSizeLow / Med / High 
DataTypeDiscrete 
DataSizeByte / Short / Integer 


Example Return Value: 0......N   where N is number of unique Value | Value combinations


Parameters

ParameterJSONDescription
Table“targetTable”: “MyTableName”The target table on which the new field will be created
Filter“dataset”: {DataSet_JSON}Optional.   If a filter is applied, records not in the filter recordset will be returned as null.
Function“p1”: “CombinedIndex”CombinedIndex
Fields [1-6]

“p1”: “Field1Name”

“p6”: “Field6Name”


At least 1 field is required
Supports:  
  • DataType: Discrete
  • Field Type: All discrete Field Types are supported. 
  • Fixed Value: 
If a continuous key field needs to be used in a combined index, first transform the key field using the STRING | CONCAT function.
Treat Null as Zero"nullIsZero": true
"nullIsZero": false

True/False.
Default = False
If true, then any null values in the input fields will be treated as if they have a value of 0.

If selected/true, then null values in Fields1-6 will be included in the value|value combinations

e.g. 

Field1value|Field2null or Field1null|Field2value will be included in the first stage string combination.

JSON Sample

{
  "method": "BuildBakedField",
  "project": "D3",
  "targetTable": "transactions",
  "overwrite": true,
  "name": "index-date-product",
  "function": "combinedindex",
  "p1": "date",
  "p2": "product"
}

Usage Notes

It is possible for the combination of values for the specified fields to exceed the maximum calculation size for the function.   If this happens, use CombinedIndex more than once in order to create the required result 

See Also:   

  • Engineering | Expression Field
  • CombinedDimension  (General Function)
  • CombinedDimensionNS (General Function)
  • CompositeLongKey (General Function)

Example

ExampleDetails
DescriptionCreate an index field from product and date
Input
  • Table: = [transactions]
  • Filter: = [No Filter]
  • Function: = CombinedIndex
  • Field 1:= [transactions].[product]
  • Field 2:= [transactions].[date]
  • Name: =index-date-product
Sample





Was this article helpful?