1 (edited by kweatherhead 2021-03-16 04:49:42)

Topic: TableGrids & Multi-Column Ordering

Greetings,

I have a TableGrid that contains several columns, two in particular are the Company Name & Division.  I need to present the Grid in Company_Name / Division order.  I presume (maybe wrong) that using the Order_BY in the TableGrids sort area I can do this but no matter what I have tried, I cannot get it to work. It sorts one field BUT not multiple fields.

If this can be done could someone demonstration the syntax for:   Form1.TableGrid1.Company  &  Form1.TableGrid1.Division... in my case the fields should both be ascending but if there is provisions for ASC/DSC could you please provide  an example of the syntax for that ORDER BY field.

Regards,
Keith

2 (edited by derek 2021-03-16 11:17:45)

Re: TableGrids & Multi-Column Ordering

Hi Keith,
Have a look at the attached;  there's also a screenshot of how you do it.
You can specify as many columns as you want and also whether you want them to be sorted descending (desc).  Ascending (asc) is the default so doesn't need to be stated.  No script is required.
In my example, the columns are all from the same table but even if they're not, the syntax is the same (tableA.field1, tableB.field6 desc) etc etc.
Note that, as with most systems, 'uppercase' is sorted before 'lowercase'. so if that compromises your sort sequence, you might want to force 'uppercase' (or 'titlecase').  If you want 'titlecase', then it's a line of script.
Derek.

Post's attachments

Attachment icon keith sort.zip 525.79 kb, 240 downloads since 2021-03-16 

Re: TableGrids & Multi-Column Ordering

Derek,

Thanx ... I was sooo close but not there,
but as usual you were spot on !!

Regards,
Keith