[DUG] Runtime user defined fields
Rohit Gupta
r.gupta at xtra.co.nz
Wed Mar 6 13:00:51 NZDT 2013
Russell,
you made it much clearer than I did :-)
I actually use TFieldType from Delphi and only support 4 types. I dont
have any issue with searching
where (Field_Type = ftInteger) and (Field_Data between 5 and 6)
where (Field_Type = ftstring) and (Field_Data = 'GLUCOSE')
work just fine.
Rohit
On 6/03/2013 12:45 p.m., russell wrote:
>
> Rohit's method is like one I use that allows users to "add fields".
>
> Users add records to an existing table. The program manages these
> records (so it appears to users) as if they are fields.
>
> The field types are important if you allow users to store data that
> will not fit into a fixed length field.
>
> I allow three data types: Text, FileNames and Memo. The first two are
> single lines of text of any length and the third handles multi-line data.
>
> All three types are stored as BLOBs in a Firebird db file.
>
> A "con" is these fields are not easily searched ... but I do not need
> this ability.
>
> Best regards,
>
> Russell
>
> *From:*delphi-bounces at listserver.123.net.nz
> [mailto:delphi-bounces at listserver.123.net.nz] *On Behalf Of *Rohit Gupta
> *Sent:* Wednesday, 6 March 2013 11:49 a.m.
> *To:* NZ Borland Developers Group - Delphi List
> *Cc:* List NZ Borland Developers Group - Delphi
> *Subject:* Re: [DUG] Runtime user defined fields
>
> 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 <mailto:delphi at listserver.123.net.nz>
>
> Admin:http://delphi.org.nz/mailman/listinfo/delphi
>
> Unsubscribe: send an email todelphi-request at listserver.123.net.nz <mailto: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.
>
>
>
> __________ Information from ESET Endpoint Antivirus, version of virus
> signature database 8082 (20130305) __________
>
> The message was checked by ESET Endpoint Antivirus.
>
> http://www.eset.com
>
>
> _______________________________________________
> 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 8082 (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/3b061cc5/attachment-0003.html
More information about the Delphi
mailing list