Knowledge Base



KB10259 - Programmatically render layer using field values in a joined external database. (code example)

For example:

  sqlDC := CreateOleObject('ADODB.Connection');
  sqlRS := CreateOleObject('ADODB.Recordset');
  sqlDC.Open('FILEDSN=GMINY.DSN');
  sqlRS.Open('select id, agri FROM QTocounty ORDER BY id', sqlDC);
  // order by ID is important!!!!

  // ll is your layer with a unique 'zone' field
  ll.ADOJoin := sqlRS;
  ll.ADOJoinPrimary := 'zone';
  ll.ADOJoinForeign := 'id';

  ll.RenderExpression := 'age'; // if our external database has such field.
  ll.RenderMinVal := 0;
  ll.RenderMaxVal := 100;
  ll.RenderZones := -5; // crucial - must be something.

  ll.RenderColorDefault := clBlue; // is nothing match
  ll.UseConfig := False; // turn off config file suggestion
  ll.RenderStartColor := clwhite;
  ll.RenderEndColor := clGreen;
  ll.AreaColor := GIS_RENDER_COLOR;
  ll.AreaOutlineWidth:=0;

 
Created: November 21, 2003, Modified: December 22, 2015
follow us on Facebook  follow us on Twitter  follow us on Google +  follow us on LinkedIn  Embarcadero