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
- All Categories
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 311 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3.8K Transform
- 656 Datasets
- 115 SQL DataFlows
- 2.2K Magic ETL
- 813 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 81 App Studio
- 45 Variables
- 771 Automate
- 190 Apps
- 481 APIs & Domo Developer
- 77 Workflows
- 23 Code Engine
- 36 AI and Machine Learning
- 19 AI Chat
- AI Playground
- AI Projects and Models
- 17 Jupyter Workspaces
- 410 Distribute
- 120 Domo Everywhere
- 280 Scheduled Reports
- 10 Software Integrations
- 142 Manage
- 138 Governance & Security
- 8 Domo Community Gallery
- 48 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 114 Community Announcements
- 4.8K Archive