Tornado API Library - V12.30.08

z.dbColSortSQL Property

User specified SQL for grid column sort.

Product Version


Property Value

Mydb.dbColSortSQL="User supplied column sort SQL with embedded [[Col]] macros"

QuickProp Keyword Abbreviation



Format of this SQL is - SELECT.... [[Col]]. The Tag [[Col]] must be included in the SQL statement and it'll be replaced by the column ordinals of the sort column(s). If this property is blank then only ORDER BY will be added to the existing SQL.

Normal single SELECT statement usually has the ORDER BY clause as the end. But in a complex compound SELECT statement, The clause might be placed in other places. This property is to provide user full control to handle that. The example shows the normal way to handle a simple SELECT statement using this user specifed SQL.

Rememebr that Fields ordinals is 0 based and ORDER BY field ordinals is 1 based.


The ORDER BY field ordinals will be placed in [[Col]].

Dim CS As New Tornado.z
With CS
   .dbQP = "U=12| S=17|Gdf=0,1,2,3,4|Sf=0,1,2,3|Isc=2,1|Sclj=t|ps=10| D=Nwind|" & _
      "Q=Orders| Th=tit=Multi-Columns Sort with User SQL"
   .dbColSortSQL = "SELECT * FROM Orders WHERE Freight > 0 ORDER BY [[Col]]"
End With

See Also

z Class | Tornado Namespace | dbSortFlds | dbInitSortCols | dbSortColLeftJustify