The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 895 - File: showthread.php PHP 7.2.34 (Linux)
File Line Function
/showthread.php 895 errorHandler->error




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sort 2-Dim Array other than on 1st elem in row (eg for Date)
#1
Hello Gintaras,
Hope all is well - I haven't posted in a long while but still am an avid QM-user!

Is it possible to sort on a 2-dim array other than on first element in each row.
I have a Date string as the 4th 'column' and want to sort on that rather than what goes into the 1st column.
This would be similar to the DlgGrid.Sort function with flags 128 for date and 0x100 (most recent to older i.e. descending).

e.g. g.Sort(128|0x100 3)
for flags as above and 3 for 4th 0th-order column

I saw this in help file:

Quote:QM 2.3.2. Supports multi-dimension arrays. Sorts rightmost dimension.

When sorting multi-dimension array, compares first element for each indice of rightmost dimension. For example, if the array has 2 dimensions, where the first used for columns and the second for rows, the function compares the first element in each row. When using callback function, the function receives reference to that element. To compare other element, adjust references as in the example.



Code:
Copy      Help
function# param str&a str&b

;initially a and b are elements in column 0

&a=&a+(2*sizeof(a))
&b=&b+(2*sizeof(b))

;now a and b are elements in column 2 ...


but don't know how to apply. Could you supply an example?

Thanks so much!,
S


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)