• array sorting

    From timepro timesheet@21:1/5 to All on Fri Oct 14 10:44:31 2022
    xlsfiles=adir(diskname()+':\tax\einvoice\'+qrc_in+'\*.xlsx')
    or
    ADIR(diskname()+':'\tax\einvoice\'+qrc_in+'\*.xlsx', xlsFiles)

    -how to get the last dated+time filename from the array?
    -how to get the largest size filename from the array?

    tia.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From poopall@21:1/5 to timec...@gmail.com on Thu Oct 20 17:33:07 2022
    On Saturday, 15 October 2022 at 4:44:33 am UTC+11, timec...@gmail.com wrote:
    xlsfiles=adir(diskname()+':\tax\einvoice\'+qrc_in+'\*.xlsx')
    or
    ADIR(diskname()+':'\tax\einvoice\'+qrc_in+'\*.xlsx', xlsFiles)

    -how to get the last dated+time filename from the array?
    -how to get the largest size filename from the array?

    tia.

    I hope I am not breaching copy right here, but an example is given in http://www.xHarbour.com Language Guides

    or see https://vivaclipper.wordpress.com/2014/01/07/asort/

    Examples

    // sort numeric values in ascending order
    ASort( { 3, 1, 4, 42, 5, 9 } ) // result: { 1, 3, 4, 5, 9, 42 }

    // sort character strings in descending lexical order
    aKeys := { "Ctrl", "Alt", "Delete" }
    bSort := {| x, y | Upper( x ) > Upper( y ) }
    ASort( aKeys,,, bSort ) // result: { "Delete", "Ctrl", "Alt" }

    // sort two-dimensional array according to 2nd element of each pair
    aPair := { { "Sun", 8 }, { "Mon", 1 }, { "Tue", 57 }, { "Wed", -6 } }
    ASort( aPair,,, {| x, y | x[ 2 ] < y[ 2 ] } )
    // result: { { "Wed", -6 }, { "Mon", 1 }, { "Sun", 8 }, { "Tue", 57 } }

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)