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 read in numbers lager then Integers?


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-24-2008, 11:12 AM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 200
Default How to read in numbers lager then Integers?

Hi guys,

I fear I keep bugging you all with questions.......

I am trying (as suggested) to read in a textfile with Table and then sort it on the first key. The problem is that the numbers (strings actually) are larger then integers (e.g. 10131543907). Reading it in as a string gives sortingresults like 1,2,3,3302,4,41 etc.
How can I get a good result sorting? Do I need to convert the strings otherwise? I cannot enforce typecasting as int64.
Also representing the string in Scientific notation disregards the powers, only sorts on the number itself.
Thnx in advance and thank you for your time
Marc
Reply With Quote
  #2 (permalink)  
Old 02-24-2008, 12:04 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 650
Default

Quote:
Originally Posted by Stellaferox View Post
I fear I keep bugging you all with questions.......


If you declare the columns as cNumber first, the loaded data is treated as numbers and not as a string, even it is bigger than an int.
I tested this
Code:
Sub App_Start
    Table1.AddCol(cNumber, "Col1", 100)
    Table1.AddCol(cNumber, "Col2", 100)
    Table2.AddCol(cNumber, "Column1", 0)
    Table2.AddCol(cNumber, "Column", 0)
    Table1.LoadCSV("test1.txt", "," ,False, False)
    Table1.TableSort("Col1 ASC")
    Form1.Show	
    For i = 0 To Table1.RowCount - 1
        Table2.AddRow(Table1.Cell("Col1",i),Table1.Cell("Col2",i))
    Next
    Table2.SaveCSV("test2.txt", "," ,False)
End Sub
with this data
Code:
201315439073333,201315439073333
10131543907,10131543907
999999999999999,999999999999999
555555555555555,555555555555555
12131543907,12131543907
5,5
999912131543907,999912131543907
4,4
20131543907,20131543907
12131543907,12131543907
202315439073333,202315439073333
121,121
This works fine as long as the table does not use exponentials to store its numbers, e.g due to a row of 9999999999999999,9999999999999999.
In this case the sorting is still ok but the exponential view is written bach to the new file.


specci48
Reply With Quote
  #3 (permalink)  
Old 02-24-2008, 12:10 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 200
Default

Specci48,

Thanks for your time and solution. It works like a charm! Now I can really make some speed on the PPC in running this this application.
Marc
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
The same random numbers LineCutter Questions & Help Needed 4 10-16-2008 06:05 PM
Numbers lock key davelew1s Questions & Help Needed 0 06-14-2008 08:26 PM
B4PObject numbers Louis Questions & Help Needed 1 05-14-2008 09:51 PM
List of possible combinations for x numbers. EdQas Questions & Help Needed 3 10-07-2007 10:18 AM
Line numbers adder derez Share Your Creations 0 07-15-2007 01:27 PM


All times are GMT. The time now is 01:30 AM.


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