SemanticQueryRequest Fields

The following are the top-level fields that compose the SemanticQueryRequest:

Field LabelTypeDescription
structuredSemanticQueryStructuredSemanticQueryRequired. Representation of a semantic query.
dataspaceStringID of the data space in which the query is executed. The default data space is used if no data space is selected.
groupIdStringID of a group of queries. The query is sent as a part of this group if this field is defined.
queryParameterStringQuery parameter name and value for parameterized queries.
semanticModelIdStringThe unique identifier of an existing semantic model to use for this query. When provided, the system will retrieve the model from the authoring service. Cannot be used together with semanticModel field.
semanticModelSemanticModelThe complete semantic model definition to use for this query. This allows you to provide the model inline without requiring it to be pre-saved. Cannot be used together with semanticModelId field.

The following are the fields within the StructuredSemanticQuery object:

Field LabelTypeDescription
fieldsrepeated QueryFieldRequired field that define the dimensions and measurements in the query and the query grouping.
filterPredicateRules that define which records to exclude from the query, including dimensions, measurements, and calculated fields. Valid values are dates, text, num-type, logic (AND, OR, NOT), and relative date.
optionsQueryOptionsDefines object limits, sort order, and row limits.
semanticContextSemanticContextCentral class configuration that manages a variety of settings that determine how the query is executed and how results are shown. Settings include time zone, fiscal year, and locale.
aggregateFilterPredicateFilter that is applied to an aggregate measurement. Valid values are Sum, AVG, Min, Max, Median, Count Distinct, Stddev, Stddevp, Var, and Varp.

The following are the fields within the QueryField object:

Field LabelTypeDescription
expressionExpressionRequired. Represents an expression within the query. A field can be any column, array, function, or constant within the query.
semanticAggregationMethodSemanticAggregationMethodDefines the aggregation method for a specific field. Valid values are None, Auto, Count, Sum, AVG, Min, Max, Median, Unique Count, Stddev, Stddevp, Var, Varp, First, Last, Unique, and User_agg.
aliasstringDefines the alias of a field within a query.
rowGroupingboolDefines whether results are grouped by a specific field (True) or not (False).
groupingGroupingRequired if the rowGrouping field is set to "True". Defines the columns used to group and manage large datasets and obtain aggregated total results for each column. Valid values are Dimensions, Measurements, Dates, Field, and Fiscal Dates.
showMissingValuesShowMissingValuesDefines data densification settings for a query field. Controls whether missing values are shown in results.

The following are the fields within the QueryOptions object:

Field LabelTypeDescription
sort_ordersrepeated SortOrderDefines how query results are sorted. Valid values are Simple Sort Order and Aggregative Sort Order.
limit_optionsLimitOptionsDefines the maximum number of rows to return from the query results.
offset_optionsOffsetOptionsDefines the offset of query results from a specific row by integer.
detailed_rowsboolDefines whether to return detailed row information in the query results.
subtotalsboolDefines whether subtotals are calculated based on the formula logic (True) or not (False). If True, subtotal measurements are calculated according to the aggregation method selected for grouping dimensions. The result of the calculation is added as a row to the Semantic Query results set. Valid values are Sum, AVG, Min, Max, Median. Default is Sum.
grand_totalboolDefines whether grand totals are calculated based on the formula logic (True) or not (False). Grand totals reflect all total values in the entire dataset in a Semantic Query and are aggregated based on user selection. Valid values are Sum, AVG, Min, Max, Median. Default is Sum.
row_countsboolDefines whether to include row count information in the query results.
join_path_planJoinPathPlanDefines the join path strategy for query execution. Valid values are JOIN_ALL_TABLES and JOIN_MINIMAL_TABLES.
smart_aggregationsboolDefines whether to use smart aggregation logic for query optimization.
apply_model_sortingboolDefines whether to apply model-defined sorting to query results.
disallow_cross_joinboolDefines whether to disallow cross joins in the query execution.

The following are the fields within the SimpleSortOrder object:

Field LabelTypeDescription
sort_bySortField sort_by_field / string sort_by_field_aliasRequired. Defines how the query results are sorted. Valid values are sort_by_field and sort_by_field_alias, where "field" and "alias" are the name of the field or alias that you want to sort by.
sorting_orderSortingOrderDefines whether the query results are sorted in ascending or descending order. Valid values are Asc and Desc.
null_values_positionNullValuesPositionDefines whether query result rows with null values appear at the top or the bottom of the response. Valid values are Nulls_first and Nulls_last.

The following are the fields within the AggregativeSortOrder object:

Field LabelTypeDescription
sort_groupExpression grouped_expression / string grouped_field_aliasRequired. Defines the sort group for the aggregative sort order. Valid values are grouped_expression and grouped_field_alias.
sort_bySortField sort_by_field / string sort_by_field_alias / bool sort_by_row_countRequired. Defines how aggregated query results are sorted. Valid values are sort_by_field, sort_by_field_alias, and sort_by_row_count. The field or alias used must be defined.
sorting_orderSortingOrderDefines whether the query results are sorted in ascending or descending order. Valid values are Asc and Desc.
null_values_positionNullValuesPositionDefines whether query result rows with null values appear at the top or the bottom of the response. Valid values are Nulls_first and Nulls_last.

The following are the fields within the SemanticContext object:

Field LabelTypeDescription
timezoneTimezoneRepresents a specific timezone. Valid values and codes can be found in the Supported Time Zones documentation.
localeLocaleRepresents a locale. Locales determine the display formats for date and time, users' names, addresses, and commas and periods in numbers. Valid values can be found in the Salesforce Supported Locales documentation.
currencyCurrencyRepresents a currency for financial calculations and display formatting.

The following are the fields within the SemanticModel object:

Field LabelTypeDescription
apiNamestringThe API name of the semantic model.
labelstringThe display label of the semantic model.
unrelatedDataObjectsQueryBehaviorSemanticQueryUnrelatedDataObjectsTypeEnumDefines how to handle querying unrelated data objects. Valid values are Exception and Union.
semanticDataObjectsrepeated SemanticDataObjectList of semantic data objects in the model.
semanticRelationshipsrepeated SemanticRelationshipList of semantic relationships in the model.
semanticCalculatedDimensionsrepeated SemanticCalculatedDimensionList of calculated dimensions in the model.
semanticCalculatedMeasurementsrepeated SemanticCalculatedMeasurementList of calculated measurements in the model.
dataspacestringThe dataspace associated with the semantic model.
semanticParametersrepeated SemanticParameterList of parameters in the semantic model.
semanticLogicalViewsrepeated SemanticLogicalViewList of logical views in the semantic model.
semanticMetricsrepeated SemanticMetricList of metrics in the semantic model.
semanticGroupingsrepeated SemanticGroupingList of groupings in the semantic model.
currencyCurrencyThe currency associated with the semantic model.
externalConnectionsrepeated ExternalConnectionList of external connections in the semantic model.
idstringThe unique identifier of the semantic model.
hasUnmappedboolIndicates whether the semantic model has unmapped fields.
businessPreferencesstringBusiness preferences for the semantic model.
agentEnabledboolIndicates whether the agent is enabled for this semantic model.

The following are the possible expression types within the Expression field:

Field LabelTypeDescription
bool_expressionboolBoolean expression value (true/false).
int_expressionint3232-bit integer expression value.
long_expressionint6464-bit integer expression value.
float_expressionfloatSingle-precision floating-point expression value.
double_expressiondoubleDouble-precision floating-point expression value.
string_expressionstringString expression value.
bytes_expressionbytesBinary data expression value.
table_fieldTableFieldReference to a physical table column.
semantic_fieldSemanticFieldReference to a virtual/semantic column.
calculated_fieldCalculatedFieldReference to a calculated field expression.
array_expressionArrayExpressionArray of expressions.
date_expressionDateExpressionDate expression without time component.
range_valuesRangeValuesRange of values with upper and lower boundaries.
null_valueNullValueNull value expression.
datetime_expressionstringDateTime expression as string.
relative_date_rangeRelativeDateRangeRelative date range expression.
forecast_fieldForecastFieldForecast field expression for predictive analytics.
relationship_formulastringRelationship formula expression.