how to sort this kind of file?

Discussion in 'Questions (Windows Mobile)' started by Stellaferox, Feb 23, 2008.

  1. Stellaferox

    Stellaferox Active Member Licensed User

    Hi all,

    OK, next question from this project that slowly is getting out of hand :sign0085:
    I have a file that is built up like keyC=>key1, keyA=>key2, keyB=>key3 etc (PHP-style)
    I cannot attach it as it is 280 kb in ZIP-format :sign0137:
    It is sorted on the "number" keys. How can I sort it on the A,B,C keys, keep the relation with the "number" key, and write this back to the same file?
    All help appreciated.......
    Thnx Marc
     
    Last edited: Feb 23, 2008
  2. specci48

    specci48 Well-Known Member Licensed User

    Hi Stellaferox,

    just a silly question from me: ;)
    What prevents you from reading the file into a appropriate table... sort the table with your preferred keys... and write it back to the file.
    Of course the last step must be done "manually" since Table.SaveCsv won't save in sort order.


    specci48
     
  3. Stellaferox

    Stellaferox Active Member Licensed User

    Hi Specci48,

    Thought of that of course, but I want to keep the relation with the other key when sorting on the first key. Can that be done?
    Marc
     
  4. Cableguy

    Cableguy Expert Licensed User

    Yes using the listview lib, it can...
     
  5. Stellaferox

    Stellaferox Active Member Licensed User

    Any limitations as to the length of the file read in?
     
  6. Cableguy

    Cableguy Expert Licensed User

    as far as I can tell, it works the same as the table controls with a few teaks...
    sMost of the props are the same....so it should be able to deal with any file lenght, limited only by the memory allocation...
     
  7. specci48

    specci48 Well-Known Member Licensed User

    As I understand the help file (looking at the "tablesort" in the main help):
    this sorting can be done by a "normal" table. You don't need to use a listview...


    specci48
     
  8. RandomCoder

    RandomCoder Well-Known Member Licensed User

    I personally like Specci48's approach best, but instead of writing back to the file manually, I would copy the sorted table across to another table and then use Table.SaveCsv to save the sorted data straight to file.

    Regards,
    RandomCoder
     
  9. Stellaferox

    Stellaferox Active Member Licensed User

    OK, nice sunday afternoon project. Project is advancing.....
    thnx all
    Marc
     
  10. specci48

    specci48 Well-Known Member Licensed User

    :sign0156:


    specci48
     
Loading...