Javascript field name has spaces
I have tried back ticks, brackets, everything I can think of
The script below works correctly and provides the results that I expect, but I really need to put Account Level 9 in the var where
Specifically Account Level 9 = Administrative expense
but when I add the field I get nothing. I can see the record in the output when I use the script below. I know it's correct but I am pretty sure it has to do with the fact that the field has spaces it in. The fields I am successful with below all do not. I do not want to go back and remove the spaces in the field name
I have tried this and a bunch of other variations
var where = ['TimeSeriesShort = YTD','RecordType = Standard','MOLongName = November','Account Level 9 = Administrative expense'];
If you could be specific in your response I would greatly appreciate it.
WORKING SCRIPT
var columns = ['RecordType','TimeSeriesShort','MOLongName',`Account Level 9`,`VAR P-A (A)`];
var fields = columns;
var where = ['TimeSeriesShort = YTD','RecordType = Standard','MOLongName = November'];
var query = `/data/v1/${datasets[0]}?fields=${fields.join()}&groupby=RecordType,TimeSeriesShort,MOLongName,'Account Level 9'&filter=${where.join()}`;
Answers
-
Hi,
Please try changing the single quotes or ticks with double quotes. This should work.
Also, is it a view or a dataset you are trying to build this on? Is it a federated connection?
Thanks
'Happy to Help'0 -
Building on DDX bricks app
Can you give me an example of what you are saying above
do I change everything to single quotes? I started that way and then changed to back ticks when it didn't work
ticks with double quotes
like this?
var columns = ['RecordType','TimeSeriesShort','MOLongName',`"Account Level 9"
,
`"VAR P-A (A)"`];0 -
Hi @Jessica
Something like this - ["RecordType","TimeSeriesShort","MOLongName","Account Level 9","VAR P-A (A)"]
You can try this. Also if this does not work, try removing the () parenthesis from the name, that could also be a possible reason for it to not work.
Let me know how it goes.
Thanks
'Happy to Help'0 -
So this works and the field that has paren in the name, is working it seems like the issue is only because it's the where and groupby?
var domo = window.domo;
var datasets = window.datasets;
var myTable = document.getElementById('myTable');
var fields = ['TimeSeriesShort','VAR P-A (A)'];
const where = ['TimeSeriesShort = CM'];
var groupby = ['TimeSeriesShort'];
var query = `/data/v1/${datasets[0]}?fields=${fields.join()}&groupby=${groupby.join()}&filter=${where.join()}`;
further down in script
function getRow(rowData, index){
var rowEl = document.createElement('tr');
var td1 = rowEl.appendChild(document.createElement('td'));
var td2 = rowEl.appendChild(document.createElement('td'));
td1.innerText = rowData['TimeSeriesShort'];
td2.innerText = rowData["VAR P-A (A)"]; this row works this or with 'VAR P-A (A)' the results are accurate both
return rowEl;
This does not work, I have tried back ticks and single quotes and double quotes unsuccessfully
var domo = window.domo;
var datasets = window.datasets;
var myTable = document.getElementById('myTable');
var fields = ["Account Level 9 Code","VAR P-A (A)"];
const where = ["Account Level 9 Code = 600011"];
var groupby = ["Account Level 9 Code"];
var query = `/data/v1/${datasets[0]}?fields=${fields.join()}&groupby=${groupby.join()}&filter=${where.join()}`;
function getRow(rowData, index){
var rowEl = document.createElement('tr');
var td1 = rowEl.appendChild(document.createElement('td'));
var td2 = rowEl.appendChild(document.createElement('td'));
td1.innerText = rowData["Account Level 9 Code"];
td2.innerText = rowData['VAR P-A (A)'];
return rowEl;
0 -
Hopefully this shorter amount of code will make it easier
Validated that this works
const where = ['TimeSeriesShort = CM','Version != OEP_Working','RANK_Version = 1','RecordType = Standard','BA_MA_SSP = Total Company Management View'];
This is just one of the MANY combinations I have tried that do NOT work. I have tried everything I can think of probably going to file a support ticket on it, back tics, single quotes, double quotes, brackets, underscores, %20   still can't figure it out and I cannot change the field name, Account Level 9 Code, has spaces.
const where = ['TimeSeriesShort = CM','Version != OEP_Working','RANK_Version = 1','RecordType = Standard','BA_MA_SSP = Total Company Management View','[Account Level 9 Code] = 600011'];
0 -
No, no response or solution. I may submit support ticket
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
- 738 Beast Mode
- 56 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
- 108 Community Announcements
- 4.8K Archive