Announcement

Collapse
No announcement yet.

Folder Sorting Possible?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #21
    " I converted the Quad to a WString because that is all that PowerCollections use."
    I'm sure Micheal will appreciate making a small error bigger for him!
    Dale

    Comment


      #22
      Totally confused, but don't need it explained.

      Comment


        #23
        Code:
        DIR$ Loop to collect the DirData structures for target filename mask into array  "DirDataArray()"
        
        ARRAY SORT DirDataArray() CALL SortRoutine
        
        FUNCTION SortRoutine (DataItem1 as DirData, DataItem2 AS DIRDATA) AS LONG
        LOCAL comparedate1 AS QUAD, compareDate2 AS QUAD
        
        Select CASE AS LONG HowToOrder ' howtoOrder = global var
        CASE %CreationDate ' program constant
             CompareDate1 = DataItem1.CreationTime
             CompareDate2 = DataItem2.CreationTime
        CASE %LastModfiedDate          ' program constant
             CompareDate1 = DataItem1.LastWriteTime
             CompareDate2 = DataItem2.LastwriteTIme
        ​CASE %AccessDate ' program constant
             CompareDate1 = DataItem1.LastAccessTime
             CompareDate2 = DataItem2.LastAccessTime
        END SELECT
           IF CompareItem1 < CompareItem2 THEN    
               FUNCTION = -1&
          ELSEIF  CompareItem1 > CompareItem2 THEN
               FUNCTION =  1&
          ELSE                                ;  must be equal
              FUNCTiON = 0
           END IF
         
        END FUNCTION
        Because QUAD is a native datatype PB can handle the comparison without any conversions necessary.

        Definition of FILETIME ==> https://learn.microsoft.com/en-us/wi...nfo/file-times


        MCM
        ​​
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


          #24
          Originally posted by Michael Mattias View Post
          Code:
          DIR$ Loop to collect the DirData structures for target filename mask into array "DirDataArray()"
          
          ARRAY SORT DirDataArray() CALL SortRoutine
          
          FUNCTION SortRoutine (DataItem1 as DirData, DataItem2 AS DIRDATA) AS LONG
          LOCAL comparedate1 AS QUAD, compareDate2 AS QUAD
          
          Select CASE AS LONG HowToOrder ' howtoOrder = global var
          CASE %CreationDate ' program constant
          CompareDate1 = DataItem1.CreationTime
          CompareDate2 = DataItem2.CreationTime
          CASE %LastModfiedDate ' program constant
          CompareDate1 = DataItem1.LastWriteTime
          CompareDate2 = DataItem2.LastwriteTIme
          ​CASE %AccessDate ' program constant
          CompareDate1 = DataItem1.LastAccessTime
          CompareDate2 = DataItem2.LastAccessTime
          END SELECT
          IF CompareItem1 < CompareItem2 THEN
          FUNCTION = -1&
          ELSEIF CompareItem1 > CompareItem2 THEN
          FUNCTION = 1&
          ELSE ; must be equal
          FUNCTiON = 0
          END IF
          
          END FUNCTION
          Because QUAD is a native datatype PB can handle the comparison without any conversions necessary.

          Definition of FILETIME ==> https://learn.microsoft.com/en-us/wi...nfo/file-times
          ​​
          Thank you for telling us what we have already said several times in this thread.

          That doesn't get over the requirement to convert a number such as:
          133390732653700000
          to something useful such as "13-Sep-23 10:07 AM" (or preferably a sortable date string such as ISO format) any time you want to display file information.



          =========================
          https://camcopng.com
          =========================

          Comment

          Working...
          X
          😀
          🥰
          🤢
          😎
          😡
          👍
          👎