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); });1
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); });1 -
Hey Pritesh,
I am working on the same issue that you had - DDX: Getting Data in DDX form.
I want to display rows of 'vendor' table as a drop down in the Ag-Grid cells. I have this table in my manifest.json as below-
{ "dataSetId": "b928d658-dd19-4243-9db3-ce021ce2b8e6",
"alias": "vendor",
"fields": [] }
and this is my domo.get() - domo.get('/data/v1/vendor?fields=vendor_name&limit=1')
I have questions from your solution as below-
- What is datasets[0] in your script? I see that your data name is dataset0 and you are using datasets[0] as the table name inside domo.get()
- new Query() is not working for me. what kind of object is this? Should I import that? I get the below error for new Query()
'Query' is not defined.
Please help me here. I am stuck with this since a week and need to get the result out.
Thank you in advance
0 -
Hi Naveen,
- 'Query' not defined. Can you paste you code snippet to get more idea? It's javascript legacy api object so shouldn't happen.
- You cannot refer your Domo dataset directly in your DDX. You have to first map the dataset(s) that you want to refer in your DDX by choosing them in your mapping section (as dataset0, dataset1 etc.) - see below for example.
1 -
Hello Pritesh,
Thanks a lot for the reply. 'vendor' is my dataset name in the Domo DDX. I want to display values of 'vendor_name' column in my dropdown
I have defined this in my manifest as below-
{ "dataSetId": "b928d658-dd19-4243-9db3-ce021ce2b8e6",
"alias": "vendor",
"fields": [] }
I am using Ag-Grid framework of React JS to build the front end interface. Input_variables() is my function call where I need to pass the data to be displayed in the dropdown of each cell.
I want to display the values returned in Input_variables as a dropdown in 'Brand Name' column in the tool as shown below-
Below is my function definition-
function Input_variables(){
var version ='';var query = new Query();
query
.select(['vendor_name'])
.groupBy('vendor_name')
.limit(1);
domo.get(query.query(vendor[0]), {format: 'array-of-arrays'}).then(function(result)
{ var row = result.rows[0];
version = row[0];
$('#vendor_name').val(version).prop("readonly", true);
})
;};
I get below error when I run this function
Can you please look at this set up and help me to get through?
Thank you in advance.
0 -
Hey Pritesh,
Did you get a chance look at the above code?
0 -
Hey Naveen - Sorry, couldn't figure it out. I suggest post it as a new thread on community so someone who've encountered similar issue can help.
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 732 Beast Mode
- 55 App Studio
- 40 Variables
- 684 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 46 Workflows
- 10 DomoAI
- 35 Predict
- 14 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 123 Manage
- 120 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 107 Community Announcements
- 4.8K Archive