Page 8 of 8 FirstFirst ... 678
Results 71 to 72 of 72

Thread: Do you use SQL queries to build your model or analyse your simulation results?

  1. #71

    Join Date
    Aug 2017
    Posts
    3
    Thanks Guillermo,

    Appears to work! Just need to incorporate it into all my queries now.

    Quote Originally Posted by Guillermo View Post
    Hi Lee,

    You could try using the subst function directly over the query as follows, I think it might work:

    SET notes = IIF(notes matches '.*Interest: ' + subst(subst(spatial.SSSI_NAME, "(","{"),")","}") + '.*',notes,notes +'&CHAR(10)&"Sites of Special Scientific Interest: ' +subst(subst(spatial.SSSI_NAME, "(","{"),")","}") + ';"');

  2. #72
    This is to add multiple lateral links to subcatchments:

    1. Run this spatial SQL to find the links inside subcatchments:
    1.JPG
    code:
    set user_text_1= spatial.subcatchment_id


    2. Run this SQL to add lateral links to subcatchments, with Object Type "Subcatchment" use this code:

    LIST $clist STRING;
    SELECT DISTINCT oid INTO $clist FROM [All Links];


    let $node_id="";
    let $link_suffix = "";
    let $subcatchment_id="" ;


    LET $i=1;
    WHILE $i <= LEN($clist);
    DESELECT ALL;


    select user_text_1 into $subcatchment_id FROM [All Links] where oid=AREF($i,$clist) ;
    select us_node_id into $node_id FROM [All Links] where oid=AREF($i,$clist);
    select link_suffix into $link_suffix FROM [All Links] where oid=AREF($i,$clist) ;


    IF $subcatchment_id <> "" and $subcatchment_id <> 0.00;
    INSERT INTO subcatchment.lateral_links(subcatchment_id, lateral_links.node_id, lateral_links.link_suffix) VALUES ($subcatchment_id, $node_id, $link_suffix);
    ENDIF;


    LET $i=$i+1;
    WEND;
    Attached Images Attached Images
    • File Type: jpg 1.JPG (48.0 KB, 9 views)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •