I am a front-end developer. On the front-end side we just take the respective variable and put it into the component, provided by GoodData - we don’t write some queries to get dynamic data - GoodData does all of that.
But I was asked to work with data, which come with variables, generated in the ‘full.js’ file. I need to know where the chart data are formed and how to do that.
Could you please direct me, where I would be able to find the tutorials for that and what I need else if need?
Best answer by Jan RehanekView original
I am not sure if I understand your question correctly, but if you are asking about retrieving data as an object that can then be worked with rather than an insight, it can be done via the various Execute components.
Code examples are available here: https://gdui-examples.herokuapp.com/execute/execute-component
For example, using the useExecutionDataView hook:
Does this help?
Thanks for answer
No, I meant another thing
I retrieve the data but I don’t form the data. I assume the data comes from somewhere. And I would like to know from where the data comes to the front-end. On the front-end we just get data and by using respective variable output our chart.
I want to know how to form them as on the back-end. Do we have to make the back end for the data. Or does GoodData provides the mechanism to create data with it, maybe it plays a role of the server regarding to the data, which we take on the front-end side? Beacuse I earlier I just ran the command ‘npm run refresh-md’ to update variables in the ‘full.js’ file, but recently I was asked to create the data themseves.
This what I meant. I wanted to figure out how to work with that if that is provided by the GoodData or to understand the conjunction between GoodData and server if it is a separate entity.
I am not sure I fully understand the question, but I think it’s probably one of two alternatives.
1/ If you’re talking about how GoodData internally processes the actual BI data from the time that it is uploaded to the time users access it, I am afraid that’s not open source.
2/ If you’d like to know how the full.js file is composed out of the catalog, that is available as part of the sdk.
The full.js file is created as a result of the code found in the catalog-export repository, which can be examined here: https://github.com/gooddata/gooddata-ui-sdk/tree/f874c8517a8c0f0169ebc0bc6cf71cc72dd9c905/tools/catalog-export
There’s also notes on this here: https://sdk.gooddata.com/gooddata-ui/docs/export_catalog.html.
Thank you, Jan!
I was interested at the second one.
May I ask you one more question?
Is there ability to provide URL query params for cases, when user uses filters?
For example, we have filter by some criteria - and in case, when user chooses some options of that criteria - we see in the URL string of the browser something like ‘tal=US&tal=EU’
What do you mean by ‘provide’ in this case? Could you describe an approximate start-end flow of what this should do and accomplish?
For example, we have chart and filter in the top. Filter contains some options in according with which user can filter data, which we have in the chart.
And when user chooses some options in the filter in order to filter the chart data (or excludes some of them) - we see changes in the URL - we see there respective query params with essence of what filtering we have after that. We also want to provide the ability to load the filtered data if we have let’s say the URL string with those query params.
Does that make sense?
I don’t think we provide support for anything like that ouf-of-the-box.
You could build a custom solution by retrieving the filter values and interacting with the URL through react-router-dom and changing the filter’s initial state from them when loading the data.
It’s important to be mindful of the fact that different browsers have different limitations on the max length of the URL, though.
I have worked on the custom solution.
But I faced the problem.
In the ‘full.js’ file I have the variable for filtering:
export const CustomDimension1 = newAttribute("label.gd_out_all_accounts.customdimension1");
I pass it to to the ‘newNegativeAttributeFilter’ to create filter object, which forwards to the ‘AttributeFilterButton’ component.
But nor ‘CustomDimension1’, no ‘filter’ variable have all filter options data. If I would have them I would provide the dynamic logic, but not now.
I logged in the console options data, when was choosing them, took their identifiers and hardcoded them in the file system to observe the option and extract the part of identifier in the URL as query param.
export const CUSTOM_DIMENSION_PARAM_PATH = "/gdc/md/vsr1rwnp6zhce7y79yliy6mfsdkctpmr/obj/675/elements?id=";
But this is not what I want - probably in the future options can be changed.
And I wonder if I can get all options list data in the variable, generated by the GoodData (‘CustomDimension1’ in this example)
Could you please say if it is possible to do?
And attached the logged ‘CustomDimension1’ variable object
Retrieving the possible options of a filter is doable via the validElements API.
For example, by sending a request (further described here: https://help.gooddata.com/doc/enterprise/en/expand-your-gooddata-platform/api-reference#operation/listAnattributeLabelValues) to:
It returns a JSON object like this (assuming that the possible options are Clothing, Electronics, Home, and Outdoor):
That is how the filter itself determines its values that are then displayed to the end user.
When I send the query:
It throws an error that I am not authorized
But I was authorized. Should I pass any headers into query? I haven’t found the authorization token there
Are you sure https://secure.gooddata.com is where you should be sending the request? That is the default example provided in our documentation, but if you’re accessing your workspaces through a different link, you should be using that one.
For example, my domain is jreh.internal.gooddata.com, so I would be sending: fetch("https://jreh.internal.gooddata.com/gdc/md/<project_id>/obj/<attr_id>/elements" etc etc.