Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


how to sort this kind of file?


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-23-2008, 09:37 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 203
Default how to sort this kind of file?

Hi all,

OK, next question from this project that slowly is getting out of hand
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
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 by Stellaferox : 02-23-2008 at 09:56 PM.
Reply With Quote
  #2 (permalink)  
Old 02-23-2008, 11:24 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 672
Default

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
Reply With Quote
  #3 (permalink)  
Old 02-23-2008, 11:31 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 203
Default

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
Reply With Quote
  #4 (permalink)  
Old 02-23-2008, 11:34 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,463
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Yes using the listview lib, it can...
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #5 (permalink)  
Old 02-23-2008, 11:37 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 203
Default

Any limitations as to the length of the file read in?
Reply With Quote
  #6 (permalink)  
Old 02-23-2008, 11:56 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,463
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

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...
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #7 (permalink)  
Old 02-24-2008, 09:03 AM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 672
Default

As I understand the help file (looking at the "tablesort" in the main help):
Quote:
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
Reply With Quote
  #8 (permalink)  
Old 02-24-2008, 09:21 AM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 487
Awards Showcase
Beta Tester 
Total Awards: 1
Default

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
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #9 (permalink)  
Old 02-24-2008, 09:40 AM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 203
Default

OK, nice sunday afternoon project. Project is advancing.....
thnx all
Marc
Reply With Quote
  #10 (permalink)  
Old 02-24-2008, 11:21 AM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 672
Default

Quote:
Originally Posted by RandomCoder View Post
I would copy the sorted table across to another table and then use Table.SaveCsv to save the sorted data straight to file.



specci48
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
SORT / TRIM Table(CSV) sintaq Questions & Help Needed 1 03-24-2008 10:52 AM
Table sort / date bob Questions & Help Needed 1 11-16-2007 09:15 AM
Please Include Some Sort Of Help File Cableguy Share Your Creations 2 08-11-2007 11:47 AM
Sort with SQL JJM Questions & Help Needed 1 06-07-2007 02:03 PM
Table Sort Problems RandomCoder Questions & Help Needed 21 05-22-2007 09:43 PM


All times are GMT. The time now is 06:08 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0