Capabilities: RTF editing, Graphs, flat-file database

Jay Madren JaysLists at triad.rr.com
Thu Jun 10 11:20:55 EDT 2004


Sarah,

Why do you need to use a custom property?  Couldn't you just do it all in a
local or global variable?  I figure you have a reason(s), but I'm not
experienced enough in RR to know the ramifications of variables versus
custom properties.

Thanks,
Jay Madren

-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com]On Behalf Of Sarah
Reichelt
Sent: Wednesday, June 09, 2004 23:44
To: Geoff Caplan; How to use Revolution
Subject: Re: Capabilities: RTF editing, Graphs, flat-file database


>>> Another very popular way is to use a single data field with one line
>>> per record, and each field in the record separated by some delimiter,
>>> usually tab. The whole field can be loaded into memory allowing very
>>> fast searching, sorting etc.
>
> Sarah, can you point me to the Rev functions you would use for this?
> Sounds like you are saying that Rev has Awk-like capabilities. This
> has the merit of simplicity. But with up to 60,000 records, I would
> have to test the speed and memory issues.
>
Supposing your complete data set is stored in a field called "Data" (or
a text file), when you start your app, set a custom property e.g. set
the cMyDataSet of this stack to field "Data"
Now your data is held in memory so it is faster to access.

I am assuming that your data is in a sort of spreadsheet format with
rows & columns
e.g. firstname <tab> lastname <tab> phone <tab> email <tab> notes <cr>

How you handle it now really depends on what manipulations you want to
do.
To sort:
put the cMyDataSet of this stack into tempVar
set the itemdelimiter to tab
sort lines of tempVar by item 2 of each  -- sorts by lastname
set the cMyDataSet of this stack to tempVar

To filter:
put the cMyDataSet of this stack into tempVar
filter tempVar with "*Smith*"  -- reduces list to only lines containing
Smith

If you want to set & retrieve data:
put "Jones" into item 2 of line 65 of tempVar
put item 3 of line 9999 of the cMyDataSet of this stack into tPhone

If you are doing of lot of line-based access, convert the data set to
an array using split
put the cMyDataSet of this stack into tempArray
split tempArray using cr

Then you can get tempArray[59999] which will be much faster than
getting line 59999 of tempVar

It is difficult to be more specific without knowing exactly what format
your data is in and how you want to manipulate it, but hopefully this
has given you some ideas to start with.

Cheers,
Sarah

_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution



More information about the use-livecode mailing list