Page tree

 

Support | BlogContact Us | 844.332.2821

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version r0411

D toc
Excerpt

Extracts the key values from a map an Object data type column and stores them in an array of string String values.

D s
snippetBasic

Column reference example:

D code

derive value:KEYS('map1object1') as:'mapKeysobjKeys'

Output: Generates a new mapKeys objKeys column containing an array of all of the keys found in the key-value maps Objects found in the map1object1 column.

Array literal reference example:

See Example - Basic keys example belowSee the example below.

D s
snippetSyntax

D code

derive value:KEYS(mapobj_col)

ArgumentRequired?Data TypeDescription
mapobj_colYstring String or mapObjectName of column or Map Object literal whose keys are to be extracted into an array

d-s-lang-notes

...

obj_col

Map Object literal or name of the map Object column whose keys you want to extract into an array.

D s
snippetusage

Required?Data TypeExample Value
Yes
Map
Object literal or column reference
myMap
myObj

D s
snippetExamples

Example - Basic keys example

Source:

Following dataset contains configuration blocks for individual features. These  These example blocks are of Map Object type.

Code formatting has been applied to the Map Object data to improve legibility.

FeatureNameConfiguration
Whiz Widget
Code Block
{
 "enabled": "true",
 "maxRows": "1000",
 "maxCols": "100"
}
Magic Button
Code Block
{
 "enabled": "false",
 "startDirectory": "/home",
 "maxDepth": "15"
}
Happy Path Finder
Code Block
{
 "enabled": "true"
}

 

Transform:

The following transform extracts the key values from the Map Object data in the Configuration column.

D code

derive value: KEYS(Configuration) as: 'keys_Configuration'

Results:

 

The keys_Configuration column contains the arrays of the key values.

FeatureNameConfigurationkeys_Configuration
Whiz Widget
Code Block
{
 "enabled": "true",
 "maxRows": "1000",
 "maxCols": "100"
}
Code Block
["enabled","maxRows","maxCols"]
Magic Button
Code Block
{
 "enabled": "false",
 "startDirectory": "/home",
 "maxDepth": "15"
}
Code Block
["enabled","startDirectory","maxDepth"]
Happy Path Finder
Code Block
{
 "enabled": "true"
}
Code Block
["enabled"]

Example - Create

...

an Object of product properties

Include Page
EXAMPLE - ARRAYSTOMAP Function
EXAMPLE - ARRAYSTOMAP Function

D s also
labelnested