#1  
Old 31st March 2004, 09:47 AM
Hugo Galindo
 
Posts: n/a
Default Create calculated field programatically


Hi

I need to add a calculated field to a TnxTable at runtime.
Is this possible? if so, how?

TIA

--
Hugo Galindo
  #2  
Old 31st March 2004, 10:55 AM
Keith Johnson [NDX]
 
Posts: n/a
Default Re: Create calculated field programatically

Hugo Galindo <hugogaNOSPAM@yahoo.com> wrote in
news:MPG.1ad3c26950625dfd9897cb@news.nexusdb.com:

>
> Hi
>
> I need to add a calculated field to a TnxTable at runtime.
> Is this possible? if so, how?
>
> TIA



Hi Hugo,

Something like->

type
TnxTableCrack=class(TnxTable); //cracker class to get to CreateFields

procedure TForm1.SetupTable;
begin
//lets create the default persitent fields
nxTable1.FieldDefs.Update;
TnxTable(nxTable1).CreateFields;

//now add our calculated fields
field:=TStringField.Create(self);
field.fieldname:='Test';
field.size:=10;
field.DataSet:=nxTable1;
field.Calculated:=true;

//Ok now we can open our table
nxTable1.open;
end;

Keith[NDX];
  #3  
Old 31st March 2004, 11:01 AM
Keith Johnson [NDX]
 
Posts: n/a
Default Re: Create calculated field programatically

"Keith Johnson [NDX]" <keith{at}saxon.co.uk> wrote in
news:Xns94BD13F33E940Keithatsaxondotcodot@203.147. 131.213:

> TnxTable(nxTable1).CreateFields;


Oops,

the above should of course read..

TnxTableCrack(nxTable1).CreateFields;

Keith[NDX];

  #4  
Old 1st April 2004, 03:57 AM
Hugo Galindo
 
Posts: n/a
Default Re: Create calculated field programatically


Works great! Thanks Keith!!

--
Hugo Galindo


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
TOSTRINGLEN on (wide) string field gives field size of 8192 Hans Hasenack nexusdb.public.support.sql 2 8th April 2009 12:33 AM
calculated values in key-expression Ad Franse nexusdb.public.support.sql 8 20th February 2009 11:32 AM
Create short index on long field;) DFH nexusdb.public.support.sql 3 1st September 2006 02:19 PM
calculated fields Rick Holland nexusdb.public.discussions 2 20th June 2006 05:31 PM
Client-Side Calculated Fields Issue with TDANexusDBDataTable L. S. Lichtmann nexusdb.public.discussions 2 25th April 2006 01:38 AM


All times are GMT +11. The time now is 08:33 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.