Very Simple Question on how to get data
Hi,
I am not familiar with how to retrieve data from a dataset. Ive tried taking premade bricks and trying to learn from that. The dataset I have is 1 row with 3 columns. I assume I would just create variable name and assign the value to the column. However, I have no idea how to get it to display. I am comfortable in HTML and CSS but since the data set updates daily I need it to change the brick daily. Any resources would be greatly appreciated, all I need is to figure out how to import those three columns (They do not need to be queried they just need to display the values they already have ) so I can change how they are displayed on the brick in CSS. Thank you
Var Date = ['date']
Var Working_Day = ['running working days']
etc.
Best Answers
-
When using Bricks, you will be querying your data using the JavaScript section of the brick. Your question really becomes a JavaScript question. If you haven't reviewed this section of the Domo Developer Docs, I would recommend looking through their tutorials.
https://developer.domo.com/portal/0037739ab3747-domo-bricks-overview
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.0 -
@ColinHaze take a look at this tutorial video and the GitHub repo in the comments:
You'll need to first use the Domo Data or SQL API to get the data from the dataset:
domo.post(/sql/v1/${datasets[0]}
,SQL QUERY HERE
, {contentType: 'text/plain'}).then(handleResult);0 -
hi @ColinHaze, I also faced the same issue as yours and experienced the same frustration. Spent few hours on this and figured it out. Sharing my solution with you.
In the HTML tab,
<!DOCTYPE html> <html lang="en"> <body> <header> <h1>Test</h1> </header> <main> <div id="result"></div> </main> </body> </html>
Then in JAVASCRIPT tab,
var domo = window.domo; var datasets = window.datasets; // get the data domo.get(`data/v1/${datasets[0]}`).then(function(result){ // assign the desired values var Date = result[0]['date'] var Working_Day = result[0]['running working days'] // link to html document.getElementById("result").innerHTML = "Today is the " + Working_Day + " of " + Date; });
Hope this helps.
0 -
And something that has driven me nuts….color and borders. Add the following to CSS.
table {
border-collapse: collapse;
width: 100%;
}
th, td {
border: 1px solid black;
padding: 8px;
text-align: left;
}
th {
background-color: #4CABC5;
color: white;
font-weight: bold;
}
td:nth-child(3) {
border-left: 3px solid black;
border-right: 3px solid black;
background-color: #A3D4E1;
}** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0
Answers
-
When using Bricks, you will be querying your data using the JavaScript section of the brick. Your question really becomes a JavaScript question. If you haven't reviewed this section of the Domo Developer Docs, I would recommend looking through their tutorials.
https://developer.domo.com/portal/0037739ab3747-domo-bricks-overview
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.0 -
@ColinHaze take a look at this tutorial video and the GitHub repo in the comments:
You'll need to first use the Domo Data or SQL API to get the data from the dataset:
domo.post(/sql/v1/${datasets[0]}
,SQL QUERY HERE
, {contentType: 'text/plain'}).then(handleResult);0 -
ellibot and MarkSnodgrass, I appreciate yalls advice, as someone who has 0 JS experience I was unable to solve this simple issue. Its frustrating because I know its so simple LOL. I think Im going to just use a simple table instead of using a DDX Brick to display this sentence. "Today is the [column1] of [column2]"
0 -
hi @ColinHaze, I also faced the same issue as yours and experienced the same frustration. Spent few hours on this and figured it out. Sharing my solution with you.
In the HTML tab,
<!DOCTYPE html> <html lang="en"> <body> <header> <h1>Test</h1> </header> <main> <div id="result"></div> </main> </body> </html>
Then in JAVASCRIPT tab,
var domo = window.domo; var datasets = window.datasets; // get the data domo.get(`data/v1/${datasets[0]}`).then(function(result){ // assign the desired values var Date = result[0]['date'] var Working_Day = result[0]['running working days'] // link to html document.getElementById("result").innerHTML = "Today is the " + Working_Day + " of " + Date; });
Hope this helps.
0 -
Go to the AppStore on the ribbon bar and search for Blank Brick or DDX Blank Brick. Pick a new dashboard or one you setup as a test. If you are appending, select your dashboard from the list. It will open with a new card. On that card it wants you to enter javascript in the first window, your html in the next, and your stylesheet information in CSS.
The example already starts with some datasets that are setup. It should start with Example Sales Data as dataset[0]. So we can do a quite pull from it like this…** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
Expanding on my answer above…the following will retrieve the whole dataset.
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
And something that has driven me nuts….color and borders. Add the following to CSS.
table {
border-collapse: collapse;
width: 100%;
}
th, td {
border: 1px solid black;
padding: 8px;
text-align: left;
}
th {
background-color: #4CABC5;
color: white;
font-weight: bold;
}
td:nth-child(3) {
border-left: 3px solid black;
border-right: 3px solid black;
background-color: #A3D4E1;
}** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 754 Beast Mode
- 61 App Studio
- 41 Variables
- 693 Automate
- 178 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive