Logo SQLinForm

 

Re: Line break with leading commas and tab

[solvedthumbs up] Line break with leading commas and tab
October 18, 2010 06:51PM
Hello, we recently purchased the Site License, and I am having trouble getting the format related to commas exactly how I need it. Basically, I want all of my lists like this:

    [*] one identifier per line
    [*] each list item one tab in from parent keyword
    [*] leading commas

For options, I disabled the "Flexible Space Calculation" option in the Indention section. I chose to indent by 4 spaces, and also checked the "Use Tab" checkbox. Each item in the comma lists is being indented with two spaces instead of a tab, but each item in a non-comma list, instance a WHERE clause, is indenting by one tab as desired. Below is a very simple example. Notice that ",col2" is indented only two spaces rather than one tab in the SQLinForm formatted string. I would like ",col2" to be aligned just as "col1", a single tab in from the "select" keyword.

Original query:
select col1,col2 from table_name where 1=1 and col1<>col2

SQLinForm output:
select
	col1
  ,col2
from
	table_name
where
	1 = 1
	and col1 <> col2

Desired output:
select
	col1
	,col2
from
	table_name
where
	1 = 1
	and col1 <> col2



Edited 3 time(s). Last edit at 12/27/2010 12:51PM by guidomarcel.
Re: Line break with leading commas and tab
October 19, 2010 05:31PM
Hi,
thanks for your feedback.
To get closer to the desired output, you can switch on the option "one space after comma". If there is no space between "," and "col2" then SQLinForm will not insert without your permission spaces.

The column names are aligned to make the SQL more beautiful and the comma is shifted to the left. Therefore the comma will not be aligned to "col1".

Hope this helps
Guido
Re: Line break with leading commas and tab
October 19, 2010 10:10PM
The columns still are not aligned in the solution proposed. col1 is aligned one tab in, whereas col2 is aligned three spaces in, plus the comma which occurs. This is due solely to the attempt to reconcile spaces with tabs, which is problematic. Mixing leading tabs and spaces makes indentation formatting a moot point. Some developers on my team may use a tab stop of three spaces, others may use a tab stop of eight spaces. The code parser here illustrates the issue of mixing tabs with spaces, and users with varying tab stops having problems. Notice how, even with the recommended option selected, how output is still not aligned. The misalignment due to mixing of tabs / spaces is accentuated here because the code parser uses eight spaces for its tab stops.

select
	col1 -- one tab (presented as eight spaces here)
  , col2 -- three spaces plus a comma
from
	table_name
where
	1 = 1
	and col1 <> col2

Everything else aligns beautifully, and I maintain that the selected options are not reflecting the expected output. My reason is, I have checked the box on Breaks(1) -> For Lists -> Before Comma. I have also checked the Overall -> Indention -> Use Tab checkbox. I do not see anywhere an exception that indicates to not honor that indention and line break setting when a comma is encountered.

This unfortunately doesn't really get us where we need to be. Our team standards are for each column, leading comma included, to be aligned one tab in on their own line. There is literally one option that, when changed, breaks or fixes things. Everything is tabbed correctly when I check Breaks(1) -> For Lists -> After Comma. I also uncheck Breaks(1) -> For Lists -> Before Comma. Here is the output:

select
	col1,
	col2
from
	table_name
where
	1 = 1
	and col1 <> col2

The issue here, again, is that commas are at the end of the line rather than the beginning of the next. Literally, the only change I need is for the comma to be "moved" to be a tab in on the line containing col2.



Edited 2 time(s). Last edit at 10/19/2010 10:12PM by haylo75.
Re: Line break with leading commas and tab
October 30, 2010 02:33AM
Hi haylo75,
could you please do me a favor and send me your SQL snippet as a text file to info @ sqlinform.com as I am not able to reproduce the issue, i.e. col1 is aligned one tab in, whereas col2 is aligned three spaces in, plus the comma which occurs.

Thanks
Guido
Re: Line break with leading commas and tab
November 01, 2010 11:31PM
Guido,

Thanks for following up, I hope your time off was enjoyable.

I will formulate an example and send it to you. Do you also want a copy of my settings file?

Thanks,
haylo75
Re: Line break with leading commas and tab
November 02, 2010 12:45PM
Hi,
a copy of the .cfg file would be great.
Regards
Guido
Re: Line break with leading commas and tab
November 17, 2010 02:40PM
Guido - I am sorry for the late reply, I had some other items at work tying me up. Please check your e-mail for a copy of my settings file and a sample query. My first post here most clearly illustrates the issue though.

Thanks,
haylo75
Re: Line break with leading commas and tab
November 29, 2010 08:16PM
Guido - Did you receive my e-mail with the settings file and sample query?

Thanks,
haylo75
Re: Line break with leading commas and tab
December 07, 2010 03:27PM
Guido - please update me as to the status on this item. We have already purchased a site license, and with the leading comma and tab issue unresolved, I am unable to release the software for use by the rest of my development team.
Guido
Re: Line break with leading commas and tab
December 13, 2010 11:13PM
Hi Haylo75,
sorry for the late reply. I did some tests with the files you sent but I could not reproduce the issue. My feeling is that you may have pasted some special characters in the formatter, probably tabs. I need some more time to do more testings.
Regards
Guido
Re: Line break with leading commas and tab
December 13, 2010 11:44PM
Guido - I am using the exact text labeled "Original query" from my first post, combined with the settings file that I sent you last month. I copied and pasted that text into an app named Notepad++, which lets me easily view non-printable characters. I have verified there are none in the text.

I am able to reproduce the issue explained with consistency. Do you need me to re-send the settings configuration file?
Re: Line break with leading commas and tab
January 16, 2011 08:52PM
Hi Haylo75,
I added 2 new options in the new oline release which will make the special instruction “haylo75” no more necessary.
The new options are called:
“Move comma 2 cols to the left”
“Always put 1 space after comma”

Regards
Guido
Re: Line break with leading commas and tab
January 20, 2011 04:28AM
Guido,

That's great news, I will download the latest online release tomorrow and test out the new options.

Thanks,
haylo75
Author:

Subject:


Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 20 plus 11?
Message: