Hello I am using GoodData for our application. My ...
# gooddata-platform
g
Hello I am using GoodData for our application. My question is related to variable and update its value dynamically. I will explain you what I have done so far. I have created variable with name organisation_id and set type to filter variable and selected attribute as a id column of one of our database table (Please check attached image - 1) After that I have set user-specific value for that variable e.g. organisation_id = 12, 34, 56 etc. After that I have create custom matrix and use this variable in MAQL e.g. SELECT COUNT(id) WHERE organisation_id (Please check attached image - 2) And then I have added this matrix in insights and in the widget it filter the data which related to value of organisation_id variable i.e. it only display data related to id - 12, 34, 56 My Quetion is: Can we update variable value using API? like in above example we set organisation_id = 12, 34, 56 now I want to update organisation_id = 89, 90 and get result related to 89 and 90 Instead of updating organisation_id value from variable setting can we update it using API? I embedded the dashboard using iframe basically before loading iframe can we update variable value using any inbuilt API of GoodData instead of updating it manually from variable setting page?
d
Hi Gaurav, let me first react to the last part of your question. You write
before loading iframe can we update variable value
May I ask why exactly would you like to do that? I'm wondering whether dashboard variable filters are not what you are looking for: https://help.gooddata.com/doc/enterprise/en/dashboards-and-insights/dashboards/using-dashboards/dashboard-filters/filter-for-variables
g
Thanks @David Kubecka for reply Last part is as below I have one workspace created and contains one dashboard which contains some graphs (widgets or insights) and I embedded this workspace by using Iframe I have 2 organisations with organisation_id 1 and 2 i have created variable organisation_id and added custom matrics to filter data related to each organisation. e.g. If I set organisation_id = 1 then it filter data related to id 1 if I set organisation_id = 2 then filter data related to id 2 when I set organisation_id from GoodData variable setting page Each organisation contains lots of users. in my application when user logged in then we render all stuff related to the organisation in which current logged in user belongs so basically I get organisation detail from user. My question is - if user A belongs to Organisation 1 and when user A logged it then I need to update the variable organisation_id value to 1 (organisation_id is variable which is created in GoodData) and render data related to that organisation_id 1 and same for other organisation I need to update organisation_id value when user logged in. Is there any API to update variable value without going to variable setting page?
d
There is indeed an API for variables management. Unfortunately is undocumented at the moment so it would be at your own risk. Given the more detailed description of your use case I see why the solution suggested by me wouldn't work. That's because you don't want your users to interact directly with the filters. It seems that you more likely want to set a specific value of an organization for each user and the user shouldn't be able to change that value. If that's the case I think Data Permissions filters might better suit your needs.