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
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 101 SQL DataFlows
- 622 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 748 Beast Mode
- 59 App Studio
- 41 Variables
- 686 Automate
- 176 Apps
- 453 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 396 Distribute
- 113 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 125 Manage
- 122 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 109 Community Announcements
- 4.8K Archive