Board index » delphi » URGENT : Why I lost the others fields

URGENT : Why I lost the others fields

Why if I declare a Calculated fields in execution time I lost all my others
fields?
( TClientDataSet  )
How can do it?

Thanks

Vinicius

 

Re:URGENT : Why I lost the others fields


Try to create a InternalCalc Field, sometimes the calculed field give us
some suprises .....

[]s
Eduardo - SP - Brazil - Rumo al Penta !

"Vinicius" <yak...@terra.com.br> escreveu na mensagem
news:3d1c9313_1@dnews...

Quote
> Why if I declare a Calculated fields in execution time I lost all my
others
> fields?
> ( TClientDataSet  )
> How can do it?

> Thanks

> Vinicius

Re:URGENT : Why I lost the others fields


The problem is :
When I create any kind of fields in a ClientDataSet the Table Data Fields
don't are showed by the dbgrid like a example...

Understand?

Vinicius Marques

"Eduardo R. Marcelino" <eduardorm_empr...@bol.com.br> escreveu na mensagem
news:3d1c98f3_1@dnews...

Quote
> Try to create a InternalCalc Field, sometimes the calculed field give us
> some suprises .....

> []s
> Eduardo - SP - Brazil - Rumo al Penta !

> "Vinicius" <yak...@terra.com.br> escreveu na mensagem
> news:3d1c9313_1@dnews...
> > Why if I declare a Calculated fields in execution time I lost all my
> others
> > fields?
> > ( TClientDataSet  )
> > How can do it?

> > Thanks

> > Vinicius

Re:URGENT : Why I lost the others fields


Create persistent fields in the CDS *before* you add any other fields.

--
Dave Rowntree

Quote
"Vinicius" <yak...@terra.com.br> wrote in message news:3d1daf0c$1_2@dnews...
> The problem is :
> When I create any kind of fields in a ClientDataSet the Table Data Fields
> don't are showed by the dbgrid like a example...

> Understand?

> Vinicius Marques

> "Eduardo R. Marcelino" <eduardorm_empr...@bol.com.br> escreveu na mensagem
> news:3d1c98f3_1@dnews...
> > Try to create a InternalCalc Field, sometimes the calculed field give us
> > some suprises .....

> > []s
> > Eduardo - SP - Brazil - Rumo al Penta !

> > "Vinicius" <yak...@terra.com.br> escreveu na mensagem
> > news:3d1c9313_1@dnews...
> > > Why if I declare a Calculated fields in execution time I lost all my
> > others
> > > fields?
> > > ( TClientDataSet  )
> > > How can do it?

> > > Thanks

> > > Vinicius

Re:URGENT : Why I lost the others fields


but my question is how can I create the another fields and the persistents
fields without to now with fields I have in the database...
something automatic?

Thanks

Vinicius

"Dave Rowntree" <da...@brookswood.co.uk> escreveu na mensagem
news:3d203624_2@dnews...

Quote
> Create persistent fields in the CDS *before* you add any other fields.

> --
> Dave Rowntree
> "Vinicius" <yak...@terra.com.br> wrote in message

news:3d1daf0c$1_2@dnews...
Quote
> > The problem is :
> > When I create any kind of fields in a ClientDataSet the Table Data
Fields
> > don't are showed by the dbgrid like a example...

> > Understand?

> > Vinicius Marques

> > "Eduardo R. Marcelino" <eduardorm_empr...@bol.com.br> escreveu na
mensagem
> > news:3d1c98f3_1@dnews...
> > > Try to create a InternalCalc Field, sometimes the calculed field give
us
> > > some suprises .....

> > > []s
> > > Eduardo - SP - Brazil - Rumo al Penta !

> > > "Vinicius" <yak...@terra.com.br> escreveu na mensagem
> > > news:3d1c9313_1@dnews...
> > > > Why if I declare a Calculated fields in execution time I lost all my
> > > others
> > > > fields?
> > > > ( TClientDataSet  )
> > > > How can do it?

> > > > Thanks

> > > > Vinicius

Re:URGENT : Why I lost the others fields


You could create persistent fields at design time if you wanted to.

Or you could call CDS.FieldDefs.Update to pull the field definitions from
the database to the CDS without opening the CDS. You can then create fields
for them, then add your calculated fields. For example:

var
  i: integer;
  f: TIntegerField;
begin
  // get the field definitions from the database ...
  CDS1.FieldDefs.Update;
  // create persistent fields for the FieldDefs ...
  for i := 0 to CDS1.FieldDefs.Count - 1 do
  begin
    CDS1.FieldDefs[i].CreateField(CDS1);
  end;
  // add a calculated field ...
  f := TIntegerField.Create(CDS1);
  f.Name := 'Blobby';
  f.FieldName := 'Blobby';
  f.Calculated := True;
  f.FieldKind := fkInternalCalc;
  f.DataSet := CDS1;
  // open the cds ...
  CDS1.Open;

--
Dave Rowntree

Quote
"Vinicius" <yak...@terra.com.br> wrote in message news:3d2097a8_1@dnews...
> but my question is how can I create the another fields and the persistents
> fields without to now with fields I have in the database...
> something automatic?

Other Threads