how to find out a field in the table exist??

[quote=272400:@Alan Sawyer]What I was referring to was in this video at 40:31 into this video

link text

If I have 50 fields in my form, I think that means I have to have 50 lines of code to save it. I was trying to see if there was a reasonable way to get the data saved.[/quote]

Hi Alan,

We have a class called Xanadu that we’re actively updating for Web Projects. It’s not quite ready for release, but check out the earlier version called EasyData.

The idea is that you initialize Xanadu to let it know about the table name, primary key, and a few other things. To load the fields, Xanadu uses introspection to find all the controls have matching fields in the table and updates controls values. We name each control using a pattern like “db_Contacts_NameFirst”. The ‘db’ is just a prefix to indicate that it’s a database control. “Contacts” is the table name and “NameFirst” is the field name. Since there are many controls types, Xanadu must be told how to deal with each control type and already knows about WebTextField, WebTextArea, WebCheckbox, WebPopupMenu, WebRadioGroup, and WebSlider. It’s super easy to add your any other control too.

Xanadu along with a Contact Manager example file will be open source. We’re speaking at XDC about Xanadu, so it’ll be released by then. :slight_smile:

My real dream is to see an updated version of Xojo’s DataControl: http://documentation.xojo.com/index.php/DataControl

I might have relied on attributes for that
one called table that indicated the source table
one called column for the column name
or maybe one for “table.column” or something

introspection could then find those & regardless of the controls name shove the right data into the right place
and you could switch what controls got what data by changing the attributes rather than relying on names of controls

and its all nicely and loosely bound rather than hard wired to control names

Great idea Norm. Would that mean that’d you’d have to sub class all the controls?

nope
thats the point
attributes are like “compile time constants” that you can find using introspection

now I have no idea how your controls know when to commit changes or how they push their data back to the db

BUT using attributes to connect the db to the control is one decent use for attributes

It will likely be part of my talk on introspection at XDC :slight_smile:

Bah - looked at my presentation notes & I use a property not an attribute
Sorry for the misdirection

Although an attribute would be nice but I’d have to talk with joe about whether thats even supported
It may not be