Formatting joins

All,

when formatting joins, I'd like the formatter to behave more consisitently:
I'd like to have every JOIN and every ON to start on a new line.

As far as I can see there are no options to modify this aspect of formatting.

Currently we have for a simple join the following result:

As you can see, the FROM and JOIN are on a single line.

Now, if I add another JOIN, I get this:

The joins are each on a separate line.
The ON predicates, however, are treated differently:
If I have a single ON predicate, it is on the same line as the JOIN,
but when I have multiple JOIN conditions, the ON clause goes onto a separate line.

Would it be possible to have one or two parameters to steer formatting of JOIN and ON clauses?

Kind regards,
Abe Kornelis

Abe,

The second ON wraps onto another line only because it doesn’t fit on the line anymore (right hand margin).

A solution could be to put all ON clauses on a next line, or none of them if there’s enough room for all.

Currently we are gradually introducing this all-or-none principle to several other clauses as well, it yields a more consistent layout.

Does this meet what you mean?

Thanks,

Andre

Andre,

it would be an improvement, but not what Iam looking for.

I would like:

  • every JOIN to start on a new line

  • every ON to start on a new line

  • every AND/OR/XOR to start on a new line

I could live with the ON clause being on the same line as the JOIN for cases where the JOIN is done on a single predicate.

To my mind, concatenating multiple conditions onto a single line reduces readability and, therefore, maintainability.

Kind regards,

Abe

===

Stumbled across this thread looking for the same answer. Anybody know if it’s possible to have the “ON” portion of joins be on a new line?

It’s still the same: you can get the ON to start on a new line, but only when the ON consists of more than 1 predicate. I do hope Dell will start work on revising the formatter soon. There are lots of small and not-so-small issues with the formatter :frowning:

Abe

I replaced the checkbox “Always put a join on a new line” by three radio buttons “Flat”, “Each join on a new line” and “Join predicate on a new line”. Apologies for replying late, for some reason I have missed the latest reply.
The first two buttons do what the checkbox used to do. And here’s how the last radio would output:

 CURSOR jfiejf
IS
SELECT abc
FROM def
INNER JOIN klmn ON pqr = stuv
INNER JOIN klmn2 ON pqr2 = stuv2
INNER JOIN klmn3 ON pqr3 = stuv3
WHERE ...

This will appear in the QP5 component version 5.290, it may take a couple a week or two before it become parts of the next beta. (QP-1330)
Once you've worked with it feel free to feed back, I appreciate your comments.

Thanks,
Andre

Hi Abe,

About “lots of small and not-so-small issues” all I could find are three of your posts regarding the formatting of comments, still open. Currently comment formatting is not fabulous indeed, I bundled a lot of past issues (also input from the other fifteen+ languages we support), and I already scheduled a major rewrite a while ago. With the other work in mind that should be something for early next year.

If you feel that other issues are worth being addressed then feel free to create threads for each of them. I really appreciate. I’ll try to have any minor issues addressed quickly.

Thanks,

Andre

André,

sometime in the past, upon reporting a few formatting issues, I received a reply that indicated that Dell has quite some formatting issues pending, and that a major rewrite of the formatter was due sometime in the (then) future.

This is what inspired me to mention a lot of pending changes. I’m sorry if I misunderstood or misrepresented the prior remark.

At the same time, I understand you’re working on the formatter, or planning to do so pretty soon. That’s good news.

We do use the formatter a lot, we’ve set standards, but a lot of colleagues refuse to use the formatter because they’re not happy with the results. Frankly said, I cannot really blame them.

I’ve stopped reporting formatter issues some time ago, as solutions seemed to be too far away to bother. I’ll be happy to beta-test formatter enhancements.
When time permits I’ll be happy to report any issues I encounter.

Kind regards, and thanks for the reponse,
Abe Kornelis