 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
[12.4.476 Pro] - Text Length for In-line Parentheses glitch |
|
The User Guide has examples of code formatting for Text Length for In-line Parentheses on pages 108 and 109.
This is the code that gets formatted:
 |
 |
SELECT id as customer_id, store_id, first_name, last_name,
(SELECT max(id) FROM orders o WHERE o.cust_id = c.id) AS last_order_id,
email, address_id, active, create_date, last_update
FROM cust c;
|
According to UG, having the Text Length for In-line Parentheses set to 60 (or greater, but that's just my guess), this code should be formatted to this:
 |
 |
SELECT id as customer_id,
store_id,
first_name,
last_name,
(SELECT max(id) FROM orders o WHERE o.cust_id = c.id) AS last_order_id,
email,
address_id,
active,
create_date,
last_update
FROM cust c;
|
(or something very similar, I tried copying the code from the UG but it gets a bit mangled).
While I've heavily modified the default settings and formatting rules I still hoped this setting would be respected upon formatting the code. Using my formatting rules this should end up like this:
 |
 |
SELECT id AS customer_id
,store_id
,first_name
,last_name
,(SELECT MAX(id) FROM orders o WHERE o.cust_id = c.id) AS last_order_id
,email
,address_id
,ACTIVE
,create_date
,last_update
FROM cust c;
|
However, that's not happening, I get this instead:
 |
 |
SELECT id AS customer_id
,store_id
,first_name
,last_name
,(
SELECT MAX(id)
FROM orders o
WHERE o.cust_id = c.id
) AS last_order_id
,email
,address_id
,ACTIVE
,create_date
,last_update
FROM cust c;
|
The aliases are aligned but the the code in parentheses is not in-lined, it is formatted as if the code was longer than the value set for Text Length for In-line Parentheses (180 in my case).
|
|
Mon Apr 01, 2024 5:53 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
I think this is a subquery formatted by SELECT...FROM rule. I would expect that result when applying formatting to the referenced query. If it was a long formula, an expression which is not a subquery, then I would expect the result you described.
|
|
Mon Apr 08, 2024 8:09 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
 |
 |
I think this is a subquery formatted by SELECT...FROM rule. I would expect that result when applying formatting to the referenced query. If it was a long formula, an expression which is not a subquery, then I would expect the result you described. |
The unwantedly formatted part is a subquery, yes, but that's not relevant. According to the User Guide, it should work with subqueries. Even the example from the User Guide shows it working on a subquery.
 |
 |
Text Length for In-line Parentheses – this option controls the treatment of sub-queries and expressions
within parentheses and allows keeping short expressions on a single line. In other words, if the text within
parentheses is shorter than the specified maximum value, the entire text within brackets is kept on the same
line. If the text is longer than the specified value, parentheses are moved to new lines and the text within
parenthesis is reformatted using regular formatting rules.
|
I also remember this thing working in the past. Though it has been broken for quite some time now, I never took the time to report it. But now I have tons of queries where it would come in handy.
|
|
Mon Apr 08, 2024 11:06 am |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|