DDX: Getting Data in DDX form

Hi,
I'm trying to bring in data in a DDX form, from a Domo dataset column using domo.get api using the following code.
But I keep getting [object Promise] as a response. All I'm trying to do is getting the distinct value of column "Version" and populate in one of the DDX form input. The value in this column is same for all rows.
Below is how it looks overall…
Best Answer
-
Not sure if using API directly works from the DDX form window console as I was not able to get data with that. I could finally make it work by using the Query object, however - as following…
var version ='';
var query = new Query();
query
.select(['Version'])
.groupBy('Version')
.limit(1);
domo.get(query.query(datasets[0]), {format: 'array-of-arrays'}).then(function(result){
var row = result.rows[0];
version = row[0];
$('#Version').val(version).prop("readonly", true); });0
Answers
-
You need to do something with the promise which in simple terms is just waiting for the data to return.
You can do something like this to do something with the data when your query is finished running
domo.get('/data/v2/dataset?limit=100') .then(function(data){ doSomethingWithTheData(data); console.log("data", data); })
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
Hi @GrantSmith - Thanks for the response. But I just want to populate the returned data from this query in an input box, I imagine it's "array-of-arrays" but it should at least show it there right? At least I want to confirm that the query did work — I saw in one of the articles that you could do "console.log()" and "debugger" but that doesn't work in the "Edit card" preview, I imagine it's working only in an IDE (like Visual Studio Code). Is there a way to test if the data is actually retrieved?
0 -
Not sure if using API directly works from the DDX form window console as I was not able to get data with that. I could finally make it work by using the Query object, however - as following…
var version ='';
var query = new Query();
query
.select(['Version'])
.groupBy('Version')
.limit(1);
domo.get(query.query(datasets[0]), {format: 'array-of-arrays'}).then(function(result){
var row = result.rows[0];
version = row[0];
$('#Version').val(version).prop("readonly", true); });0
Categories
- All Categories
- 1.1K Product Ideas
- 1.1K Ideas Exchange
- 1.2K Connect
- 966 Connectors
- 254 Workbench
- Cloud Amplifier
- 1 Federated
- 2.4K Transform
- 75 SQL DataFlows
- 499 Datasets
- 1.8K Magic ETL
- 2.7K Visualize
- 2.2K Charting
- 360 Beast Mode
- 19 Variables
- 481 Automate
- 101 Apps
- 376 APIs & Domo Developer
- 6 Workflows
- 22 Predict
- 6 Jupyter Workspaces
- 16 R & Python Tiles
- 316 Distribute
- 64 Domo Everywhere
- 252 Scheduled Reports
- 59 Manage
- 59 Governance & Security
- 1 Product Release Questions
- 5K Community Forums
- 37 Getting Started
- 23 Community Member Introductions
- 63 Community Announcements
- 4.8K Archive