<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body><div style="text-align: center;"><div style="text-align: left;"><font size="3"><span style="font-style: italic; font-weight: bold;"><span style="font-weight: bold;"></span></span></font>Dear all,<br>A trying to write a trigger that would automatically create lines joining points in the sequence in which i insert them. If I insert point AA then BB then CC, i want lines drawn as AA-BB & BB-CC, Using the trigger below lines are drawn ( atleast i can see the gid in table links) without the geometry.<br>May anyone advise me on this.<br>Thank you<br><font size="3"><span style="font-style: italic; font-weight: bold;"></span></font></div><font size="3"><span style="font-style: italic; font-weight: bold;">CREATE OR REPLACE FUNCTION insert_new_links() RETURNS "trigger" AS '</span><br style="font-style: italic; font-weight: bold;"><span style="font-style: italic; font-weight: bold;">DECLARE</span><br style="font-style: italic; font-weight: bold;"><span style="font-style: italic; font-weight: bold;">startpoint geometry;  </span><br style="font-style: italic; font-weight: bold;"><span style="font-style: italic; font-weight: bold;">endpoint geometry;</span><br style="font-style: italic; font-weight: bold;"><br style="font-style: italic; font-weight: bold;"><br style="font-style: italic; font-weight: bold;"><span style="font-style: italic; font-weight: bold;">BEGIN</span><br style="font-style: italic; font-weight: bold;"><span style="font-style: italic; font-weight: bold;">startpoint = asEWKT(NEW.the_geom)  WHERE NEW.gid = NEW.gid;</span><br style="font-style: italic; font-weight: bold;"><span style="font-style: italic; font-weight: bold;">endpoint = asEWKT(NEW.the_geom) WHERE NEW.gid = NEW.gid+1;</span><br style="font-style: italic; font-weight: bold;"><br style="font-style: italic; font-weight: bold;"><span style="font-style: italic; font-weight: bold;">INSERT INTO links(the_geom)</span><br style="font-style: italic; font-weight: bold;"><span style="font-style: italic; font-weight: bold;">VALUES(MakeLine(startpoint, endpoint ));</span><br style="font-style: italic; font-weight: bold;"><br style="font-style: italic; font-weight: bold;"><span style="font-style: italic; font-weight: bold;">RETURN NEW;</span><br style="font-style: italic; font-weight: bold;"><br style="font-style: italic; font-weight: bold;"><span style="font-style: italic; font-weight: bold;"> END'</span><br style="font-style: italic; font-weight: bold;"><span style="font-style: italic; font-weight: bold;"> LANGUAGE plpgsql;</span><br style="font-style: italic; font-weight: bold;"><span style="font-style: italic; font-weight: bold;">   </span><br style="font-style: italic; font-weight: bold;"><br style="font-style: italic; font-weight: bold;"><span style="font-style: italic; font-weight: bold;">    CREATE OR  TRIGGER insert_new_links_insert</span><br style="font-style: italic; font-weight: bold;"><span style="font-style: italic; font-weight: bold;">    BEFORE INSERT ON nodes </span><br style="font-style: italic; font-weight: bold;"><span style="font-style: italic; font-weight: bold;"> FOR EACH ROW</span><br style="font-style: italic; font-weight: bold;"><span style="font-style: italic; font-weight: bold;">    EXECUTE PROCEDURE insert_new_links();</span></font><br></div><br>Broun Uganda<br><br><br /><hr />Change is good. See what's different about Windows Live Hotmail. <a href='http://www.windowslive-hotmail.com/learnmore/default.html?locale=en-us&ocid=RMT_TAGLM_HMWL_reten_changegood_0607' target='_new'>Check it out!</a></body>
</html>