CombinedDimensionNS
  • 1 Minute to read
  • Dark
    Light
  • PDF

CombinedDimensionNS

  • Dark
    Light
  • PDF

Article summary

General Functions: CombinedDimension_NS

Create a new discrete field from the concatenated string values for field 1 to 6. No separator is used to delimit the component values.

Purpose

Use this function to:
  • Build unique keys for creating joins
  • Create an input field for performing a FirstDiscrete on one or more fields


Return Value

FieldType

String

FieldSize

low-med-high

DataType

discrete

DataSize

Byte / Short / Integer

[field1Value][field2value]

e.g.

clothes2020-01-12

Parameters

Component

JSON

Description

Table

“targetTable”: “MyTableName”

The target table on which the new field will be created

Filter

“dataset”: {DataSet_JSON}

Optional. Must come from target table. Records not in the filter will have a null value in the resulting field.

Fields [1-6]

“p1”: “Field1Name”

“p6”: “Field6Name”

All fields must come from target table.

All discrete Field Types are supported.

At least 1 field must be specified

If a continuous key field needs to be used in a combined dimension, first transform the key field using the CONCAT function.

Include Null

“includeNull”:

If selected/true, then any null values in Fields1-6 will be included and denoted using null.

e.g.

clothesnull or null2019-0101

JSON sample

{
  "method": "BuildBakedField",
  "project": "D3",
  "targetTable": "transactions",
  "overwrite": true,
  "name": "product-date-ns",
  "function": "combineddimension_ns",
  "p1": "product",
  "p2": "date"
}
{
  "method": "BuildBakedField",
  "project": "D3",
  "targetTable": "transactions",
  "overwrite": true,
  "name": "product-date-ns-2020",
  "function": "combineddimension_ns",
  "p1": "product_group",
  "p2": "date",
  "dataSet": {
    "logic": "or",
    "name": "Year_2020",
    "strict": true,
    "set": [
      {
        "logic": "and",
        "stype": "FIELD",
        "entity": {
          "type": "field",
          "name": "transactions.Year",
          "table": "transactions",
          "valueFilter": []
        },
        "op": "=",
        "values": [
          "2020"
        ]
      }
    ]
  }
}

JSON for CombinedDimension_NS supports the same parameters as CombinedDimension

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 CombinedDimension_NS more than once in order to create the required result.

See Also:

Example

Create product-date-ns key field

  • Table: = Transactions
  • Function: = CombinedDimension_NS
  • Filter:= [No Filter]
  • Field 1: = product
  • Field 2: = date
  • Include Null = False
  • Name = product-date-ns

Create product-date-ns-2020 key field

  • Table: = Transactions
  • Function: = CombinedDimension_NS
  • Filter:= [Year=2020]
  • Field 1: = product
  • Field 2: = date
  • Include Null = False
  • Name = product-date-ns-2020



Was this article helpful?

What's Next