How can we help you today? How can we help you today?

Suggestion For From Clause Formatting Option

Please consider offering a formatting option for the FROM section to do the following:

- align the word JOIN in all rows
- align the word ON in all rows
- align the right-most character in the relationship (=, <>, >, <)
- align the periods after the alias on both the left and right side of the relationship

It would look something like this (except for the word wrapping done by the message board):
  SELECT rpu.&#91;RemoteProcessingUnitID&#93;,
         rpu.&#91;RemoteProcessingUnitDescription&#93;,
         mgl.&#91;ShortDesc&#93;,
           m.&#91;MeasurementID&#93;,
           m.&#91;MeasurementDescription&#93;,
           o.&#91;WhenObserved&#93;,
           o.&#91;Reading&#93;
    FROM &#91;QTT&#93;.&#91;Observation&#93; o      INNER JOIN &#91;QTT&#93;.&#91;ExpectedMeasurement&#93;   em ON  em.&#91;ExpectedMeasurementID&#93;  =   o.&#91;ExpectedMeasurementID&#93;
                                    INNER JOIN @MeasurementIDs              mid ON mid.&#91;MeasurementID&#93;          =  em.&#91;MeasurementID&#93;
                                    INNER JOIN &#91;QTT&#93;.&#91;RPU_Equipment&#93;          e ON   e.&#91;RPU_EquipmentID&#93;        =  em.&#91;RPU_EquipmentID&#93;
                                    INNER JOIN &#91;QTT&#93;.&#91;RemoteProcessingUnit&#93; rpu ON rpu.&#91;RemoteProcessingUnitID&#93; =   e.&#91;RemoteProcessingUnitID&#93;
                                    INNER JOIN &#91;QTT&#93;.&#91;Location&#93;               l ON   l.&#91;LocationID&#93;             =  em.&#91;LocationID&#93;
                                    INNER JOIN &#91;QTT&#93;.&#91;Measurement&#93;            m ON   m.&#91;MeasurementID&#93;          = mid.&#91;MeasurementID&#93;
                               LEFT OUTER JOIN &#91;QTT&#93;.&#91;GEN_LookupTables&#93;     mgl ON mgl.&#91;RecordID&#93;               =   m.&#91;MeasurementGroupID_G13&#93;
   ORDER BY rpu.&#91;RemoteProcessingUnitID&#93;,
            mgl.&#91;ShortDesc&#93;,
              m.&#91;MeasurementDescription&#93;,
              o.&#91;WhenObserved&#93;
PaulLach
0

Comments

2 comments

  • marcorusso
    Each developer has his preferences and I think you need to add a lot of options :-)
    Some examples about this code.
    SELECT
      field1,
      field2,
      &#40;SELECT SUM&#40; value &#41;
       FROM tablename t1
       WHERE t1.ID = o.ID AND t1.date &lt; '20060101'&#41; AS field3
      &#40;SELECT SUM&#40; quantity &#41;
       FROM tablename t1
       WHERE t1.ID = o.ID AND t1.date &lt; '20060101'&#41; AS field4
    FROM orders o
    LEFT JOIN orderDetails od
      ON od.OrderID = o.OrderID 
    


    *** 1) Distinguish between subquery and first-level query
    You already did something by allowing to write the subquery in the same column, but in general I would prefare to have completely redundant settings between first-level query and eventual subqueries. I want to be able to do the subquery in columns with a selection of parameters different than the one in the external query (WHERE condition and SELECT columns in the same row as the keyword)

    *** 2) The option "Column placement" should be differentiated by the kind of keyword: I would like a different setting for SELECT columns (I put them on a new line), FROM / JOIN (table name in the same line), WHERE (may be I like a new line), ORDER BY / GROUP BY (same line if one column, new line if two or more columns).
    Moreover, I like to be able to get, for each setting, a different behavior if I have only a column after a keyword or more than one (eventually parameterizing this, but in my case 1 would be good more of the times).

    *** 3) Absolutely add an export settings feature

    *** 4) I would like to have many settings defined in different configurations, with a way to select a different configuration for each lay out operation (with a default but a shortcut to easily rotate between different configurations or simply selecting another one based on some preview)

    It's enough by now... I tried to layout some complex query I have and at current state I wouldn't use this feature very much (except refactoring code written by someone else...).

    Marco
    marcorusso
    0
  • Andras B
    As you mentioned, everyone has his own style. The nearly thirty options we support make the tool highly customizable, but there is place for more. We will certainly consider your new option request and will try to include them in the next beta or the final release.

    Many thanks,
    Andras
    Andras B
    0

Add comment

Please sign in to leave a comment.