DataGrid Optimization question

zryip theSlug zryip.theslug at gmail.com
Sat Sep 18 09:56:13 EDT 2010


On Sat, Sep 18, 2010 at 1:36 PM, Monte Goulding
<monte at sweattechnologies.com> wrote:
>
>> Where the data of a datagrid are stored? In a custom property...
>
> sure
>>
>> I give you two alternatives:
>> - store a data formatted for datagrids in a custom property of a
>> stack, a card, an object, etc
>> - store a data formatted for datagrids in a special object which
>> display the data in a snap if you need it as parameters behind the
>> scene and has is own API to manipulate your data easily: a datatagrid
>
> What about the cost of all the object creation/manipulation that you don't need if you are just using it as data storage.

I speak about something easy to manipulate and you reply with cost.
If you starts to think like that you will probably not using the
datagrid object and use a simple field where each record is separated
by return and each fields by tab.

>> What will be your best choice?
>>
>> Andrew has made his choice, and I think that is far to be stupid.
>
> I don't think either of us called it stupid. I'd like to understand why he, now you feel it's necessary.

Necessary... Never spoke of necessity here. Spoke about trick or
option. Necessity could appears with constraints. We have no
constraints here. Or maybe one: that is not handy!!!!!

Let's put things in context. I take my case: I'm just a rev hobbyist
and I start rev in january. A newbie if you prefer. I have to manage
parameters to display things in a datagrid. To define a kind of
dictionary with no database. I want to be able to update by hand my
dictionary anytime I want, add new definitions, new columns, remove
things, etc.

My two options are:

1) using a custom properties to store my data. I have columns and
rows, so I will choose an array.

How to fill this array the first time? By code?
- In the msg box. Uhm, no!
- In a button? I have to keep it outside my project? Okay I need two
stacks. One for my visible project, one I will keep for me in my
computer, just to define the custom property.

Now the code itself. I have to define each values of my array by code?
With repetitive lines?? Sorry but this kind of thing makes me sick.
Not for me!
Even if I have to do that, I open a soft like Excel, define a
dictionary, generates the code with formula and I copy paste the code.
Crazy no?

Okay now I have my array, and I'm choosing to store it in the main
stack of my project.

And now what, I have to update a definition in my dictionary. I have
to do that by code??? Or directly in the custom property by hand???
Okay I'm capable but that is archaic!!!

2) Using a datagrid to define my dictionary. Sorry but here I smile.
It's like Excel!!
I can add a new column, a new line, duplicate an existing line, update
a cell and the array is refreshed with no code. Ohhh happiness!!!
With an additive library I wrote, I can copy the necessary keys I need
from a datagrid to another just by a detection of the matching names
of each. I can copy all the lines or a sample of lines with a custom
find command too. Nirvana!!!

And now you come with your question: why you feel it's necessary? Do I
really have to tell you why????? 8-)

So yes I have more objects than necessary, but I live very well with
that. Terribly well. My library works for me and I have no more code
to define. Zen!!
And if I have the need of a database, be sure that I will have tables
to define the same dictionary and an interface to create new records
with no need to do that by a new SQL request.

That is the way I'm developing all the time. Sorry.

>
>> If you are not convinced, I invite you to download the Step by Step
>> N#2 tutorial I wrote about datagrids or join the open beta of the Data
>> Grid Helper to download the plugin.
>> The visible datagrids of those stacks are able to display different
>> contents and data trees. How do you think I'm doing that with no
>> database?
>> Yes I'm using custom properties, the custom properties nested in the datagrids.

> I downloaded your tutorial and I can't see where it says anything about the use of a hidden datagrid for data storage. I can imagine a very simple application being based around data storage in a visible datagrid but even then I would use custom property sets in an invisible stack saved in an appropriate place to get data to persist over multiple sessions.

It's just an example. Do not explain how it works in this tutorial.
You manage your invisible stacks with the code you want, I would not
see that. 8-)


Regards,
-- 
-Zryip TheSlug- wish you the best! 8)
http://www.aslugontheroad.co.cc



More information about the Use-livecode mailing list