Is it possible to retrieve Variables when using Bricks?
Brand new to Bricks here. If we add a variable to a dashboard that should change the behavior of all cards including a brick, can we check the value for that variable in the Javascript section to so we can adjust our query or logic accordingly?
I saw in this video that you can add controls to the brick itself, but was wondering if the brick can leverage the controls that have been added to the Dashboard instead, if so how?
https://www.youtube.com/watch?v=15nXTopnRcI&t=605s
Not really sure where to find all the information on what is available as part of the domo object and what data can we expect to find in it, like I saw you can use the filterContainer one to pass a filter to the dashboard, but not sure if you could retrieve the variables that have been overwritten this way or not (I tried sending a variable as a pfilter in the past but didn't managed to make it work).
Thanks,
Best Answer
-
hello @marcel_luthi .
First I want to clarify for some that might read this thread thinking we are talking about the Variables product.
https://domo-support.domo.com/s/article/7903767835031?language=en_US
Bricks and Custom Apps do NOT work with the Variables product and there is no current workaround. Now when you're not talking about the Domo Variables product, but just talking about a passing data from one brick to another brick or another dashboard, there's one approach that comes to mind. One very common use case is the need to persist filters from one dashboard to another. This is accomplished using a combination of
domo.onFiltersUpdate() and appDB.
The steps could look like this:
- The app/brick exists on both Dashboard 1 and Dashboard 2
- The app uses
domo.onFiltersUpdate()
(https://developer.domo.com/portal/e947d87e17547-domo-js
) to listen for page filters being added/removed on the page - Whenever that listener triggers, you can store the filters in a javascript variable
- Write the data in that variable to an appDB collection
- Navigate to new dashboard
- On initial render, that brick, the same brick that was on the first dashboard, reads from appDB to find the filters that you previously wrote to appDB.
- It then uses
domo.FilterContainer()
to apply page filters on the new page
There are other things you'd have to catch and account for, like avoiding a permanent loop of writing to appDB then reading to appDB then applying filters then writing to appDB etc.
Similarly, if you have 2 bricks and you want some action you take in brick 1 to change behavior in brick 2, you can use appDB to pass those values to the other brick.
Here is the appDB documentation:https://developer.domo.com/portal/1l1fm2g0sfm69-app-db-api
4
Answers
-
hello @marcel_luthi .
First I want to clarify for some that might read this thread thinking we are talking about the Variables product.
https://domo-support.domo.com/s/article/7903767835031?language=en_US
Bricks and Custom Apps do NOT work with the Variables product and there is no current workaround. Now when you're not talking about the Domo Variables product, but just talking about a passing data from one brick to another brick or another dashboard, there's one approach that comes to mind. One very common use case is the need to persist filters from one dashboard to another. This is accomplished using a combination of
domo.onFiltersUpdate() and appDB.
The steps could look like this:
- The app/brick exists on both Dashboard 1 and Dashboard 2
- The app uses
domo.onFiltersUpdate()
(https://developer.domo.com/portal/e947d87e17547-domo-js
) to listen for page filters being added/removed on the page - Whenever that listener triggers, you can store the filters in a javascript variable
- Write the data in that variable to an appDB collection
- Navigate to new dashboard
- On initial render, that brick, the same brick that was on the first dashboard, reads from appDB to find the filters that you previously wrote to appDB.
- It then uses
domo.FilterContainer()
to apply page filters on the new page
There are other things you'd have to catch and account for, like avoiding a permanent loop of writing to appDB then reading to appDB then applying filters then writing to appDB etc.
Similarly, if you have 2 bricks and you want some action you take in brick 1 to change behavior in brick 2, you can use appDB to pass those values to the other brick.
Here is the appDB documentation:https://developer.domo.com/portal/1l1fm2g0sfm69-app-db-api
4 -
Thanks, I was talking about the functionality between the two products: Bricks and Variables, so thanks a lot for the clarification. The additional information will certainly come in handy for other use cases.
1
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 57 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive