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.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive