Is there anyway to maintain casing of the alias in...
# suiteql
r
Is there anyway to maintain casing of the alias in the select statement ? Basically I want the JSON keys in pascal case. For eg: CustomerName Instead of it changing into customername.
s
Others here do more SQL gymnastics than I'm comfortable with so perhaps will have an answer. If it were me I'd probably post-process the output in code (i.e.
.map()
them to transform the shape as desired)
r
Want to keep the code as dynamic as possible, created one custom record to store queries. And in the request JSON the custom record internal id is a parameter. Based on that it's giving Response. Basically trying to do an inactive 120+ restlet we have in one of the accounts. For each small small task they had created one restlet. Which is taking tons of maintenance.
s
My guess is that SuiteQL is case-insensitive because the underlying database is also (*for table and column names), so likely no, there’s nothing you can do in the query to enforce that. I have tried myself and experienced the same thing. However, with the right code you can get the results you want. For example, in a Map/Reduce, returning the following query in getInputData:
SELECT CompanyName, OverdueBalance, DaysOverdue FROM Customer
In the map phase, you can do this:
const { values } = JSON.parse(mapContext.value);
const [CompanyName, OverdueBalance, DaysOverdue] = values;
And then you’ll have the values you want, with variable names using PascalCase, or whatever format you need. Just make sure to keep the constants in the same order they are in the select statement.