[DUG] Runtime user defined fields

Rohit Gupta r.gupta at xtra.co.nz
Wed Mar 6 11:48:44 NZDT 2013


I would consider having a generic table where you soft-add the fields

Ref_Num : autoinc
Owner_Num : int64
Field_Name : string (16)
Field_Type : integer // ord(TFieldType)
Field_Data  : string (255)  // store everything as string but the type 
above tells you what it is

This way you dont alter the database.  You dont have to worry about 
indexes etc.  Everyones database is the same.  Yet you can search for 
data for a particular field name.  I am actually using this structure in 
a three projects.

Regards

Rohit

On 6/03/2013 10:41 a.m., Steve Peacocke wrote:
> Hi everyone,
>
> I've been away from programming for a while so please excuse the
> seemingly simple question.
>
> I'm designing a user interface for a new application and wondered if
> there was a generally accepted way that this "should" be done.
>
> The application will allow end users to edit their forms allowing them
> to add, move, and remove fields at runtime. I'm using MySQL but I was
> wondering if there was an accepted way of adding and changing fields
> to a database.
>
> I know I can use SQL for this but I also don't want to make every
> application unable to be managed or upgraded. Perhaps I can ensure
> that the 3-4 permanent fields are never able to be altered (ID, Name,
> etc) but allow the user (through a suitable user-friendly interface)
> to go crazy adding such fields as My_favourite_colour, Rating,
> Priority, Notes, etc. etc.
>
> I'm able to give a suitable user-friendly interface to allow them to
> physically alter the Delphi form at runtime, but wondered about the
> "most appropriate way" to modify the fields to the database.
>
> 1. I could simply add fields using SQL's ALTER TABLE
> 2. I could add another table with fields such as TableName, FieldName,
> Type, etc.. and add to that
> 3. Some other spiffy way that you people will suggest that I haven't
> even thought of yet.
>
> Any suggestions?
>
>
> Steve Peacocke
> +64 220 612-611
> http://www.nzorient.co.nz
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at listserver.123.net.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at listserver.123.net.nz with Subject: unsubscribe
>
>
> __________ Information from ESET Endpoint Antivirus, version of virus signature database 8081 (20130305) __________
>
> The message was checked by ESET Endpoint Antivirus.
>
> http://www.eset.com
>
>
>
>


-- 
Regards

*Rohit Gupta*
B.E. Elec., M.E., Mem IEEE, Member IET
Technical Director
Computer Fanatics Ltd

*Tel *4892280
*Fax *4892290
*Web *www.cfl.co.nz
------------------------------------------------------------------------
This email and any attachments contain information, which is 
confidential and may be subject to legal privilege and copyright. If you 
are not the intended recipient, you must not use, distribute or copy 
this email or attachments. If you have received this in error, please 
notify us immediately by return email and then delete this email and any 
attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20130306/5cbab802/attachment-0003.html 


More information about the Delphi mailing list