Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) 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, 10:12 AM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 269
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, 11:04 AM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 1,057
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
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""," ,FalseFalse)
    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, 11:10 AM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 269
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 Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
The same random numbers LineCutter Questions (Windows Mobile) 4 10-16-2008 05:05 PM
Numbers lock key davelew1s Questions (Windows Mobile) 0 06-14-2008 07:26 PM
B4PObject numbers Louis Questions (Windows Mobile) 1 05-14-2008 08:51 PM
List of possible combinations for x numbers. EdQas Questions (Windows Mobile) 3 10-07-2007 09:18 AM
Line numbers adder derez Share Your Creations 0 07-15-2007 12:27 PM


All times are GMT. The time now is 08:47 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0