Hi, Is it possible to get the raw data of an insig...
# gooddata-ui
h
Hi, Is it possible to get the raw data of an insight from the Backend sdk api? I would like to know if there is an alternative. We are currently approaching the following image. In the attached image, I'd like to get 3 rows of record data.
j
Hello. Have you explored the following hook? https://sdk.gooddata.com/gooddata-ui-apidocs/v8.12.0/docs/sdk-ui.useinsightdataview.html#__docusaurus In case you'd like to get data that's not tied to a pre-existing insight, there's also the useExecutionDataView hook.
🙏 1
h
Thank you for your reply. I will check it out!
Thank you for your reply! It looks like the way to get RawData is different for DisplayForm and other types (fact,attribute,etc...). Is there an approach provided to get the data for DisplayForm types?
j
Hi @Higashi Kota - I am not sure I entirely understand what you’re trying to do, but if it is about getting the labels of the individual attribute fields the measure is sliced by, maybe it’d be best to look here: https://gdui-examples.herokuapp.com/execute/use-insight-data-view-hook (If you examine the source code expand):
Copy code
const UseInsightDataViewExample: React.FC = () => {
    const { result, error, status } = useInsightDataView({ insight: idRef(Md.Insights.PieChart) });
    const series = result?.data().series().toArray();
    const slices = result?.data().slices().toArray();
There’s various objects returned here and it is possible to retrieve the attribute labels from them. I am not 100% sure if this is the best way to do it, so I will ask and let you know.
🙏 1
Especially the method below provides an object that should contain all the data you’re looking for.
Copy code
const slices = result?.data().slices().toArray();
🙏 1