Function createAttribute
createAttribute(
json):Attribute
Creates an Attribute instance from the given JSON object. If the JSON object contains a granularity property, a LevelAttribute instance is created.
This function is used in the generated data model code to create dimension attributes from an input data source.
See also functions createDimension and createDateDimension.
Parameters
| Parameter | Type | Description |
|---|---|---|
json | any | JSON object representing the attribute |
Returns
An Attribute instance
Example
import { createAttribute } from '@sisense/sdk-data';
const revenue = createAttribute({
name: 'Revenue',
type: 'numeric-attribute',
expression: '[Commerce.Revenue]',
});