Weird formatting issue

  • Just saw this one pop up, not sure if it is a "known" bug or not, but thought I'd report it as I didn't see it in this section.

    If I have the following code:

    SELECT [T1].* -- or could do [T2].*, not certain which table row you are trying to show, you may just want *
    FROM
    AS [T1]
    INNER JOIN
    AS [T2] ON
    ([T1].[field] = 'NE' AND [T2].[NE] = 1) OR
    ([T1].[field] = 'SE' AND [T2].[SE] = 1) OR
    ([T1].[field] = 'NW' AND [T2].[NW] = 1)

    (sample taken from a different thread), in the "edit" window and the "code" window, I see the following:

    SELECT [T1].* -- or could do [T2].*, not certain which table row you are trying to show, you may just want *

    FROM [table_1] AS [T1]

    INNER JOIN [table_2] AS [T2] ON

    ([T1].[field] = 'NE' AND [T2].[NE] = 1) OR

    ([T1].[field] = 'SE' AND [T2].[SE] = 1) OR

    ([T1].[field] = 'NW' AND [T2].[NW] = 1)

    With the _ replaced by spaces. If you take out the _'s, then the formatting goes all weird. It happens inside the code formatting window AND outside the code formatting window. For example:

    <-- that is [table_1] without the _ in it.

    EDIT - edited because I noticed that it happens on code formatting as well as outside the code formatting. Did not test in the topic title as I didn't want to risk breaking SSC.

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

  • Mr. Brian Gale wrote:

    Just saw this one pop up, not sure if it is a "known" bug or not, but thought I'd report it as I didn't see it in this section.

    If I have the following code:

    SELECT [T1].* -- or could do [T2].*, not certain which table row you are trying to show, you may just want *
    FROM
    AS [T1]
    INNER JOIN
    AS [T2] ON
    ([T1].[field] = 'NE' AND [T2].[NE] = 1) OR
    ([T1].[field] = 'SE' AND [T2].[SE] = 1) OR
    ([T1].[field] = 'NW' AND [T2].[NW] = 1)

    (sample taken from a different thread), in the "edit" window and the "code" window, I see the following:

    SELECT [T1].* -- or could do [T2].*, not certain which table row you are trying to show, you may just want * FROM [table_1] AS [T1] INNER JOIN [table_2] AS [T2] ON ([T1].[field] = 'NE' AND [T2].[NE] = 1) OR ([T1].[field] = 'SE' AND [T2].[SE] = 1) OR ([T1].[field] = 'NW' AND [T2].[NW] = 1)

    With the _ replaced by spaces. If you take out the _'s, then the formatting goes all weird. It happens inside the code formatting window AND outside the code formatting window. For example:

    <-- that is [table_1] without the _ in it.

    EDIT - edited because I noticed that it happens on code formatting as well as outside the code formatting. Did not test in the topic title as I didn't want to risk breaking SSC.

    You can't break the SSC forums much worse than they already are. 😉  And, no... that's not me being sarcastic... that's stating a fact. 😉

    You should trying writing an article sometime.  It can be a bit brutal when it comes to actual format and the position of graphics.

     

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • test

    SELECT [T1].* -- or could do [T2].*, not certain which table row you are trying to show, you may just want *

    FROM [table_1] AS [T1]

    INNER JOIN [table_2] AS [T2] ON

    ([T1].[field] = 'NE' AND [T2].[NE] = 1) OR

    ([T1].[field] = 'SE' AND [T2].[SE] = 1) OR

    ([T1].[field] = 'NW' AND [T2].[NW] = 1)

    and no underscore for table1

    SELECT [T1].* -- or could do [T2].*, not certain which table row you are trying to show, you may just want *

    FROM [table1] AS [T1]

    INNER JOIN [table_2] AS [T2] ON

    ([T1].[field] = 'NE' AND [T2].[NE] = 1) OR

    ([T1].[field] = 'SE' AND [T2].[SE] = 1) OR

    ([T1].[field] = 'NW' AND [T2].[NW] = 1)

    no both underscores

    SELECT [T1].* -- or could do [T2].*, not certain which table row you are trying to show, you may just want *

    FROM [table1] AS [T1]

    INNER JOIN [table2] AS [T2] ON

    ([T1].[field] = 'NE' AND [T2].[NE] = 1) OR

    ([T1].[field] = 'SE' AND [T2].[SE] = 1) OR

    ([T1].[field] = 'NW' AND [T2].[NW] = 1)
  • test

    SELECT [T1].* -- or could do [T2].*, not certain which table row you are trying to show, you may just want *

    FROM [table_1] AS [T1]

    INNER JOIN [table_2] AS [T2] ON

    ([T1].[field] = 'NE' AND [T2].[NE] = 1) OR

    ([T1].[field] = 'SE' AND [T2].[SE] = 1) OR

    ([T1].[field] = 'NW' AND [T2].[NW] = 1)

    and no underscore for table1

    SELECT [T1].* -- or could do [T2].*, not certain which table row you are trying to show, you may just want *

    FROM [table1] AS [T1]

    INNER JOIN [table_2] AS [T2] ON

    ([T1].[field] = 'NE' AND [T2].[NE] = 1) OR

    ([T1].[field] = 'SE' AND [T2].[SE] = 1) OR

    ([T1].[field] = 'NW' AND [T2].[NW] = 1)

    no both underscores

    SELECT [T1].* -- or could do [T2].*, not certain which table row you are trying to show, you may just want *

    FROM [table1] AS [T1]

    INNER JOIN [table2] AS [T2] ON

    ([T1].[field] = 'NE' AND [T2].[NE] = 1) OR

    ([T1].[field] = 'SE' AND [T2].[SE] = 1) OR

    ([T1].[field] = 'NW' AND [T2].[NW] = 1)
  • I think the formatting can be weird, but not seeing the issue.

    Do you have a screenshot of what's broken/weird on your side? I'm chrome, 119.0.6045.200

  • @steve-2 Jones - replace the _ with a space and you'll see what's happening.

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

  • OK, sorry, moving too fast this am. I missed that.

    Test 2, space for table 1

    SELECT [T1].* -- or could do [T2].*, not certain which table row you are trying to show, you may just want *

    FROM
    AS [T1]

    INNER JOIN [table2] AS [T2] ON

    ([T1].[field] = 'NE' AND [T2].[NE] = 1) OR

    ([T1].[field] = 'SE' AND [T2].[SE] = 1) OR

    ([T1].[field] = 'NW' AND [T2].[NW] = 1)

    space for both tables

    SELECT [T1].* -- or could do [T2].*, not certain which table row you are trying to show, you may just want *

    FROM
    AS [T1]

    INNER JOIN
    AS [T2] ON

    ([T1].[field] = 'NE' AND [T2].[NE] = 1) OR

    ([T1].[field] = 'SE' AND [T2].[SE] = 1) OR

    ([T1].[field] = 'NW' AND [T2].[NW] = 1)
  • We that's interesting.

  • I'll log a bug. I hope this is an easy fix.

  • One nice thing is that with email notifications, things show up how you would expect. The other fun thing is it happens outside of the code block too:

    those above lines are "table 1" with square brackets around it.

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

  • Yeah, the parsing for the code formatting is that there are so many cases with the regex and replacement that I think we're fixing one thing but breaking another.

    Bug filed with this URL. We'll see what they say

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply