Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Load whole table into Memory
Message
From
21/08/2007 05:25:55
 
 
To
21/08/2007 03:37:31
Suhas Hegde
Dental Surgeon
Sirsi, India
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 6 SP5
Miscellaneous
Thread ID:
01249262
Message ID:
01249294
Views:
20
You got me prety confused here;
I believe you would be better off without using arrays but one (or more) tmp cursor having desired values as fields.
Simply seek symbol value then to scan while and insert into result cursor.
That will be sure very fast.
Here is meta code which might get you started (Aldough I still don't understand what you wanted to achieve)
select bhav_data
local aa(1)
afields(aa)
create cursor syBhav from array aa
alter table alias() add column nOpen N(12,2)
alter table alias() add column nHigh N(12,2)
alter table alias() add column nLow N(12,2)
*etc
.
. 

** then indexes you need for post processing
INDEX ON DTOS(DATE)+SYMBOL TAG PK
index on symbol+dtos(date) tag pk1   && Not present in the link below
.
.
somesymbol=YourForm.sometextbox.value
select bhav_data
seek somesymbol 
scan while bhav_data.symbol= somesymbol 
   scatter memvar 
   m.nOpen = mton(open)
   m.nHigh = mton(high)
   m.nLow  = mton(low)
   .
   .
   insert into syBhav from memvar 


endscan

select syBhav
browse normal

*then you do something with that result set.
Of course sql statement can do the same thing, it is just that this way
you might have some more flexibility.

That temp cursor can contain all values you planned to stick into arrays
per one sysmbol value and thus be reasonably easier to digest.

You don't need to blow up cashe :)

HTH




>hi,
>Ok, sorry If I offend You.
>
>What I basically want do is
>
>Table structure
>
> create table bhav_data.dbf free ;
> (symbol c(20),series c(20),open Y,high Y,low Y,close Y,;
> last Y,prevclose Y,tottrdqty I,tottrdval Y,;
> sma9 Y,sma12 Y,sma26 Y,;
> timestamp c(12),date d,delqty I,delpercent N(6,2))
>
> select bhav_data
> INDEX ON DTOS(DATE)+SYMBOL TAG PK
> index on symbol+dtos(date) tag pk1 && Not present in the link below
> INDEX ON SYMBOL TAG SYU Unique
> index on date tag dau Unique
> index on date tag da
> INDEX ON SYMBOL TAG SY
>
>No of records 800000
>Size 121686 kb - DBF , 21457KB - cdx
>
>link
>http://rapidshare.com/files/49732096/bhav_data.part01.rar
>http://rapidshare.com/files/49732097/bhav_data.part02.rar
>http://rapidshare.com/files/49732098/bhav_data.part03.rar
>http://rapidshare.com/files/49732099/bhav_data.part04.rar
>
>Please change the floats to Curriecy and Timestamp to c(12) and delpercent to n(6,2)
>tottrdqty to I
>
>
>what i want to acomplish
>
>set exclusive on
>
>use bhav_data alias bhav in 0
>select bhav
>set order to tag dau asce
>scan
> select mton(open) from bhav_data where symbol = bhav.symbol into array aopen order by date
> select mton(high) from bhav_data where symbol = bhav.symbol into array ahigh order by date
> select mton(low) from bhav_data where symbol = bhav.symbol into array alow order by date
> select mton(close) from bhav_data where symbol = bhav.symbol into array aclose order by date
> select tottrdqty from bhav_data where symbol = bhav.symbol into array avolume order by date
> select date from bhav_data where symbol = bhav.symbol into array adate order by date
>
>* process the array adate,aopen,ahigh,alow,aclose,avolume in a FLL
>*process the results from the fll
>
>endscan
>
>
>What is the fastest way ?
>
>suhas
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform