Knowledge Base Article
KB10259 - How can I construct an ADOJoin to an external attribute table and then programatically set up the renderer to render the shapes in a layer based on a value in a field in this table? Could you send me sample code to show me how?
Sure:
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: 2003-11-21, Modified: 2005-09-14
|