Active Query Builder support area

The GlobalIndent seems to have no effect

Avatar
  • updated
  • Completed

The GlobalIndent seems to have no effect

The IndentInPart does have an effect and indents the From parts a bit

Ideally in the future you want an indent for the subquery as a whole i.e everything between the brackets

SELECT F1,G2
FROM xyztable
Inner join .....
left join
-----(Select j1,y2
-----From
-----Where)
Where .... etc

Not urgent

Avatar
Andrey Zavyalov, PM

Hello,

I confirm this problem. We'll fix it as soon as possible.

Avatar
Andrew Kennard

Is this in the latest release notes related to this thread or something else ?

The error with quotation of sub-query text in the cells of Select List
Control is fixed.

Avatar
Andrey Zavyalov, PM

Hi,

No, this problem hasn't been fixed yet.

Avatar
Andrey Zavyalov, PM

Hello,

The bug is fixed in the latest version 1.26.22. Please confirm that it's fixed on your side.
Avatar
Andrew Kennard

Yes this IndentGlobal now works, thanks .... it was a bug ..... it now indents the whole query ..... but it wasn't really the problem I wanted solving .....

Which was that I wanted the SUB QUERY parts indented more that the parent part of the query i.e. like this
SELECT F1,G2
FROM xyztable
Inner join .....
left join
-----(Select j1,y2
-----From
-----Where
-----Inner Join ....
-----left join
----------(Select t1,u2
----------From
----------Where)
-----)
Where .... etc

Not urgent but it would make things more readable

Avatar
Andrey Zavyalov, PM

Use the ActiveQueryBuilderX.SQLFormatFrom.IndentGlobal to format the query the way you need.

There are four sets of formatting options:

  • SQLFormatMain - for the main query formatting
  • SQLFormatFrom - for derived tables (sub-queries in the FROM clause used as datasources)
  • SQLFormatCTE - for Common Table Expressions
  • SQLFormatExpression - for sub-queries in expressions
Avatar
Andrew Kennard

Ah OK yes I can now see setting SQLFormatFrom to say 10 gives me almost what I want

It appears that the problem is whatever logic is used to split the Join lines (Inner Join etc) does not honour this indent for the sub query

So you end up with the select and columns indented by x spaces but when it gets to wrapping a Join line for the subquery it is wrapped to coliumn 1 and not under the I of Inner Join

Hope that makes sense

Avatar
Andrey Zavyalov, PM

There are four properties of the ISQLBuilderSelectFormat to set new lines after any token of the FROM clause, try to play with them:

  • FromNewLineAfterDatasource
  • FromNewLineAfterJoin
  • FromNewLineBeforeComma
  • FromNewLineBeforeJoinExpression


Avatar
Andrew Kennard

Thanks I have had a play with some of those and others and they do make the SQL iutput different but none of them appears to stop this type of wrapping in a subquery


--Left Join (Select qvwCampaignLinks.Contact_Ref As Contact_Ref,
qvwCampaignLinks.ID As Journal_Number
------------From qvwCampaignLinks
------------Where qvwCampaignLinks.[Key] In ('DON0002')
------------Union All
------------Select qvwCampaignLinks.Contact_Ref As Contact_Ref,
qvwRegularGivingPayments.Journal_Number As Journal_Number
------------From qvwCampaignLinks
--------------Inner Join qvwRegularGivingPayments On qvwCampaignLinks.ID =
qvwRegularGivingPayments.Agreement_Number

Avatar
Andrew Kennard

Just replaced above spaces with dashes so you can see layout as this forum removed the spaces