Update a fact
PUT {{baseUrl}}/api/model/facts/:factId
Updates a specific fact in the changeset, based on the definition provided in the request body. It returns the fact's updated definition in the changeset. In the request body, ”expressions” contains a list of fact expressions. The changeset ID can be obtained using the changeset creation API. An authorization token is required to execute the request and can be obtained using Authentication endpoints. To save the change in the metadata, commit using the changeset commit API.
Each fact expression contains expression
and tables
.
tree
or tokens
format.
Revenue - Cost
. When the fact expression is represented as tokens, the text is broken down into pieces (tokens) with information about what these pieces represent in the metadata: (Revenue
, RevenueID), (-
, MinusID), (Cost
, Cost_ID).tables
: A list of tables that the expression
applies to. Warehouse partition base tables and metadata partition mapping tables are not allowed here.dataType
is optional. If omitted, it calculates based on the first fact expression.
Body
PARAM
Key | Datatype | Required | Description |
showExpressionAs
|
string | This parameter specifies the format in which the expressions are returned in response. This parameter applies to the expressions in a fact or attribute and custom expressions used in a filter, prompt, security filter, custom group, etc. Expressions are presented in the following formats: * "text": A human readable, but non-parsable text, describing the expression. This is the default format that is always returned in the response. * "tree": A tree data structure fully defining the expression. This format can be used if you want to examine and modify the expression programmatically. * "tokens": A list of parsed tokens. This format can be used if you want to examine and modify the expression using the parser component. Note that generating tokens requires additional time. Tokens are a semi-structured representation of MicroStrategy expression text that includes object references. For example, let’s say a filter expression is "Revenue > Cost". When the filter expression is represented as tokens, the text is broken down into pieces (tokens) with information about what these pieces represent in the metadata: ("Revenue", Revenue_ID), (">", GreaterThan_ID), ("Cost", Cost_ID). If omitted, the expression is returned in "text" format. If `tree`, the expression is returned in "text" and "tree" formats. If `tokens`, the expression is returned in "text" and "tokens" formats. | |
showExpressionAs
|
string | This parameter specifies the format in which the expressions are returned in response. This parameter applies to the expressions in a fact or attribute and custom expressions used in a filter, prompt, security filter, custom group, etc. Expressions are presented in the following formats: * "text": A human readable, but non-parsable text, describing the expression. This is the default format that is always returned in the response. * "tree": A tree data structure fully defining the expression. This format can be used if you want to examine and modify the expression programmatically. * "tokens": A list of parsed tokens. This format can be used if you want to examine and modify the expression using the parser component. Note that generating tokens requires additional time. Tokens are a semi-structured representation of MicroStrategy expression text that includes object references. For example, let’s say a filter expression is "Revenue > Cost". When the filter expression is represented as tokens, the text is broken down into pieces (tokens) with information about what these pieces represent in the metadata: ("Revenue", Revenue_ID), (">", GreaterThan_ID), ("Cost", Cost_ID). If omitted, the expression is returned in "text" format. If `tree`, the expression is returned in "text" and "tree" formats. If `tokens`, the expression is returned in "text" and "tokens" formats. | |
showPotentialTables
|
boolean | This parameter specifies whether to return the potential tables that the expressions can be applied to. If `true`, the "potentialTables" field returns for each fact/attribute expression, in the form of a list of tables. If `false` or omitted, the "potentialTables" field is omitted. | |
fields
|
Curl curl -X PUT 'baseUrl/api/model/facts/:factId?showExpressionAs=tree&showExpressionAs=tree&showPotentialTables=true&fields=' -H 'X-MSTR-AuthToken: authToken' -H 'X-MSTR-MS-Changeset: rd_changesetId' -H 'Content-Type: application/json' -d '{"information":{"subType":"fact","name":"Profit","destinationFolderId":"publicObjectsFolderId"},"expressions":[{"expression":{"tokens":[{"value":"TOT_DOLLAR_SALES - TOT_COST"}]},"tables":[{"objectId":"9A28CFCC42DB8E9627D547975958C138","subType":"logical_table","name":"CITY_MNTH_SLS"},{"objectId":"54D82D5B4BD115DA313C03A5742900AE","subType":"logical_table","name":"CUSTOMER_SLS"}]}]}' ENDPOINTS |