RX-Lib Field creation by program. lazarus / 16-Databases ---------------------------------------------------------------------- iru · 2017-05-19 01:19 Gentlefolk, Environment: Linux Mint 18.1,laz 1.6,FPC 3.0.0. RX from lazarus-ccr- svn-5845-components-rx-trunk.zip. Does anyone have an example of creating fields by program? I have the following code which crashes on the 'open' with an unknown field type.   vField := tField.Create(Self);   vField.DisplayLabel := 'fredo';   vField.FieldName := 'laced';   vField.SetFieldType(ftString);   RX1.Fields.Add(vField);   RX1.Open;  The 'open' code (procedure TField.SetFieldType(AValue: TFieldType) in Fields.inc is 'empty',no code at all.  Any help appreciated,Ian. ---------------------------------------------------------------------- ttomas · 2017-05-19 09:54 Never create TField. In your case you need TStringField descendat Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i vField := TStringField.Create(Self);...// vField.SetFieldType(ftString); ---------------------------------------------------------------------- iru · 2017-05-19 12:09 hank you ttomas, That helps  my code and understanding of things, however..... The 'open' works. The following code fails with 'No dataset assigned for field: place'   RX1.Open;   RX1.First;   RX1.Edit;   RX1.FieldByName('place').AsString := '10';  There is a complete (I Think) structure: DBGrid1>DataSource1>RX1.I thought the 'place' field would be relatedto RX1. If I add  ' vField.DataSet := RX1'   as follows   vField.DataSet := RX1;   RX1.Fields.Add(vField);  Compiles clean but gives 'Duplicate fieldname: 'place' on RX1.Fields.Add I am lost...Any help (examples?) appreciated, Ian. ---------------------------------------------------------------------- mangakissa · 2017-05-20 08:39 How about the oldfasioned way? This is an example for building a memtable with tbufdataset: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i begin  ClDataSet := TBufDataset.Create(nil);  with ClDataSet do  begin    FieldDefs.Add('veldnaam',ftString, 50);    FieldDefs.Add('waarde',ftString, 255);  end;  ClDataset.CreateDataset;  ClDataSet.Active := true;end; ---------------------------------------------------------------------- ttomas · 2017-05-20 20:02 Setting DataSet property of Field also adds Field in Fields of Dataset. Check SetDataSet method of TField! vField.DataSet := RX1; //  RX1.Fields.Add(vField); //Field is added in prev line