AnsweredAssumed Answered

NSQL Tip - using "comma first" syntax

Question asked by Paul_Maxwell Employee on Sep 1, 2009
Latest reply on Jun 4, 2010 by Kery
One of the syntax conventions I have adopted for NSQL is to reverse the conventional placement of commas in SQL.

Why? In Clarity a NSQL query is visible through a textarea and typically commas at the end of long NSQL lines are not visible. The issue I have with this is that if you attempt to introduce corrections/additions it is easy to forget to include the needed comma(s) - and if this happens it can be very tedious to locate and correct the problem(s).

It's SO much easier if commas are the first character in attribute rows! See this image as an example of what I mean.

I'm not suggesting you change all your existing queries, but the small Excel spreadsheet attached below may help you adopt this "comma first" syntax.

in brief:
1. paste heading row of sql result into 1st worksheet of spreadsheet
2. break this into cells via data > text to columns > space delimited
3. copy this set of cells
4. paste special > transpose into NSQL maker worksheet (lower or UPPER worksheets provided)
5. change dimension name (cell B1)
6. your attribute NSQL is prepared for you - comma first
7. paste into your Clarity query

treats 1st row as the dimension
only one dimension included (repeat process for multi-dimensions)
all attributes treated as properties not metrics - you can edit that bit

Hope you like it.