how to sort this kind of file?

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:

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
 

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
 

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...
 

specci48

Well-Known Member
Licensed User
As I understand the help file (looking at the "tablesort" in the main help):
Sorting can be done by more than column (in case of repeating values) using , (comma).
Example:
Table1.TableSort ("colFamilyName ASC, colFirstName ASC")
this sorting can be done by a "normal" table. You don't need to use a listview...


specci48
 

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
 
Top