Good morning everyone, I’m trying to retrieve dat...
# gooddata-ui
j
Good morning everyone, I’m trying to retrieve data for an Attribute of a View using
getItems()
. Since the first parameter of
getItems()
supports either an Attribute or a Measure (
forItems(items: IAttributeOrMeasure[], filters?: INullableFilter[])
), I tried passing Attributes (e.g.,
Attribute1
) to display
a count of Attribute1
in each Category. This works fine when I use a Measure (with a Metric ID in
full.ts
), but when I try it with Attributes only (no Measure involved), I get a 400 error from the
execute
call. In my case, I need to pull the data directly from a view (
Md.Category
and
Md.Attribute
), and I do have the
Metric ID
available in
full.ts
. Can anyone help with the correct approach to retrieve Attribute data?
Copy code
backend
        .workspace(workspace)
        .execution()
        .forItems([Md.Attribute1], filters)
        .withDimensions(newDimension([Md.Category]))
        .execute();
k
New message text here
j
I tried the approach, still getting 400 but it is a different error mesage: "An error has occurred while calculating the result" reason: "xtab-columns: The limit for the maximum size of the dimension with metrics was exceeded. Limit: 1_000. Actual: 7_944." @kapa.ai
k
A message from kapa.ai
The error message you are seeing: > "xtab-columns: The limit for the maximum size of the dimension with metrics was exceeded. Limit: 1_000. Actual: 7_944." means that your query is returning more than 1,000 unique values in a dimension that contains metrics (measures). In GoodData Cloud, when a dimension contains metrics, the maximum allowed cardinality (number of unique values) is 1,000. If you exceed this, the backend will return a 400 error [[Community Slack](https://gooddataconnect.slack.com/archives/C04S1MSLEAW/p1719533494848949?thread_ts=1719533494.848949&cid=C04S1MSLEAW)]. Why does this happen? - When you include both attributes and measures in your execution, the dimension that contains the measure group is subject to the 1,000 unique value limit. - In your case, you have 7,944 unique values in the dimension, which exceeds the limit. What can you do? - Reduce the number of unique values in the dimension by applying filters to limit the data set. - Aggregate or group your data so that fewer unique values are returned. - If you only need attribute values (not aggregated with measures), consider using the API endpoint for collecting label elements, which is designed for listing attribute values and is not subject to the same metric dimension limits [[Technical Limits](https://www.gooddata.com/docs/cloud/api-and-sdk/api/access_raw_data_through_api/#technical-limits)]. Summary: You must keep the number of unique values in any dimension with metrics at or below 1,000. If you need to work with more, you will need to filter or restructure your query [[Community Slack](https://gooddataconnect.slack.com/archives/C04S1MSLEAW/p1719533494848949?thread_ts=1719533494.848949&cid=C04S1MSLEAW)]. Let me know if you need guidance on how to restructure your query or use the label elements API!
j
@kapa.ai I managed to get facade data, but facade.data().slices().toArray() is any emptry []
k
A message from kapa.ai
If
facade.data().slices().toArray()
returns an empty array (
[]
), it means that there are no data slices available in the data view. This typically happens when the execution result is empty—either because the query returned no data (due to filters, data model, or other reasons), or because the execution definition did not produce any slices (for example, if there are no attributes in the result, or the data set is empty). According to the documentation, the
slices()
method returns a collection of data slices available in the data view, and
toArray()
will return an empty array if there are no data slices [[IDataSliceCollection.toArray() method](https://sdk.gooddata.com/gooddata-ui-apidocs/v10.41.0/docs/sdk-ui.idataslicecollection.toarray.html#idataslicecollectiontoarray-method)]. Possible reasons for empty slices: - The execution returned no data (e.g., due to filters excluding all data). - The execution definition did not include any attributes, so there are no slices to return. - The data set itself is empty for the given query. What you can do: - Double-check your execution definition to ensure you are including attributes. - Verify that your filters are not too restrictive. - Check that your data model contains data for the attributes and measures you are querying. If you need to debug further, you can log the raw result or check the status and error properties from your data fetching hook to see if there are any clues about why the result is empty [[Working with the results](https://www.gooddata.com/docs/gooddata-ui/latest/learn/visualize_data/create_custom_visualizations/#working-with-the-results)]. If you provide more details about your execution definition or filters, I can help you troubleshoot further.
m
Hello @Julia Chen, could you please confirm that the answer from our AI Assistance was helpful? Please do not hesitate to let us know if you need a hand with anything else.