Phoenix error - unsure why
Hello all, I'm exploring Phoenix charts and I have my query like this:
const ds = 'DS_Name' const select = ['dept_code_name', 'absval', 'trx_date']; const where = ['account = 8981', 'dept_code = 459', 'trx_date last 1 month']; const dategrain = ['trx_date by month']; const query = `/data/v1/${ds}?fields=${select.join()} &filter=${where.join()} &dategrain=${dategrain.join()} &orderby=trx_date `; domo.get(query).then(function(data){ console.log("Data", data); });
Manually filtering my dataset, it returns 176 rows of data, which I'm also getting in the console
The issue is that it's not rendering the chart, I have it set up to a simple Bar Chart. Console is returning these messages:
Any ideas of why this happens? Let me know if you need more info or code snippets.
Comments
-
@MartinB not seeing your code, if i had to guess you're having difficulties with asynchronous functions.
domo.get is an async function (hence the use of .then). so all your rendering has to happen inside the .then function unless you're using state to store the data.
if your function is
domo.get(query).then(function(data){ console.log("Data", data); }) data ... graph method
this will fail because data doesn't exist yet when your code executes the graph method. (recall, an asynchronous function means that domo.get() does not guarantee when it'll receive a response from the API, so the rest of the code (graph method) keeps executing and ... eventually, you'll get a response from domo.get().
if you're not comfortable with async / await (which would be a decent solution for this problem) localStorage may be an option too: https://gomakethings.com/using-localstorage-to-save-user-data-with-vanilla-javascript/
Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"1 -
Yeah I fixed that last night and it worked, now I'm currently struggling with the properties of the chart (doh!) dived into the documentation as of now
0
Categories
- 10.5K All Categories
- 8 Connect
- 918 Connectors
- 250 Workbench
- 473 Transform
- 1.7K Magic ETL
- 69 SQL DataFlows
- 478 Datasets
- 209 Visualize
- 257 Beast Mode
- 2.1K Charting
- 12 Variables
- 18 Automate
- 355 APIs & Domo Developer
- 89 Apps
- 3 Workflows
- 20 Predict
- 5 Jupyter Workspaces
- 15 R & Python Tiles
- 247 Distribute
- 63 Domo Everywhere
- 243 Scheduled Reports
- 21 Manage
- 42 Governance & Security
- 183 Product Ideas
- 1.2K Ideas Exchange
- 11 Community Forums
- 27 Getting Started
- 14 Community Member Introductions
- 55 Community News
- 4.5K Archive