sounds like what you need is a binary search routine. Woody --- On Mon, 10/26/09, skywlkerluc <[email protected]> wrote:
From: skywlkerluc <[email protected]> Subject: [nsbasic-ce] Re: Tech Note 08a: Files with Records and Fields - need help ! To: [email protected] Date: Monday, October 26, 2009, 11:24 AM Hi Gerges, Thank you so much for this first reply YES, the recoards are sorted with the first field ! I wrote this : AddObject "newObjects. utilctls. SFMain", "FS" Set File = FS.OpenFile( "\my documents\pda. txt") and the result is : Microsoft VBScript compliation error - line 2,cahr 12 cannot use parens when calling a sub I understand that my call is not well formulated but how openning the file that is in this diectory ? What is difference between POS ans SEEK function ? Considering the size of my datafile I was thinking of using loop seach using upper/lower comparison with my reading Hexcode and positionning the reading on middle of previous interval; so this should cut seaching time in something around 20 reading loop to find the correct line for my 100.000 lines file ; am I right ? Is ther any book or literature in (better in French) about NSBasic avaialble ? Many thanks again for your precious help Sky --- In nsbasic...@yahoogro ups.com, "George Henne" <g...@...> wrote: > > Are the records sorted by the first field? > > If so, you should be able to use the POS function to do a binary search > into the file - which will be much faster. > > > >Hi all, > > > >I must said I am new with NSBASIC but have some pratice with other > >langages like VB, PHP, JAVA.... > > > >I have a 2MB file "csv" with two field : > >first field is hexadecimal 8 bytes > >Second field is decimal codeded coded on 12 bytes > >the file should support almost 100.000 records > >This list is generated outside and order on first field. > > > >I have to retreive the good data line with hexa code (first field) > >comming from MIFARE card reader (I already have done it !) > > > >Reading line by line take more than 10 minutes and is not acceptable so > >when Reading the Tec Note 8a it seem this is exactly what I need > >but description with too few sample code is not enought for me... > > > >Can anybody give me the fist few lines to open my file (test.txt) > >and use record.field( index) to get the indexed line in my file > >Then close the file > > > >With those few line I think I would be able to integrate what I need to > >do with it > > > >Thanks for any help > > > >Sky > > > > > > > > > > > > > > > > > > > > > >----------- --------- --------- ------- > > > >Yahoo! Groups Links > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nsb-ce" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nsb-ce?hl=en -~----------~----~----~----~------~----~------~--~---
