If you’re using Tim Diedrich’s SuiteQL suitelet in your Netsuite instance to generate a table of results and want to present this result but don’t like the column headers, or if you’re using the result of your SuiteQL query in the rest of your code using the query.asMappedResults() function and want to modify the column names, then here’s a couple of things you can do.

Include spaces in column name

If you want to make your column header more readable for presentation purposes then the simplest way to do this is to wrap the alias name of the column in double quotes, like so:

1
2
3
4
5
SELECT
    LEVEL AS "column name with spaces"
FROM
    DUAL
CONNECT BY LEVEL < 5

This will produce a table looking this:

column name with spaces
1
2
3
4

Change column name

If instead your using the results of the query in a asMappedResults() function then you’ll want to be specific with the names of the columns as these will be property values in your array of objects returned.

If this is your need, then all you need do is just enter your name as follows:

1
2
3
4
5
SELECT
    LEVEL AS my_column_name
FROM
    DUAL
CONNECT BY LEVEL < 5

Then when your result is output as an array of objects using asMappedResults() you’ll get the following:

1
2
3
4
5
6
7
8
9
[{
    "my_column_name": 1
}, {
    "my_column_name": 2
}, {
    "my_column_name": 3
}, {
    "my_column_name": 4
}]