
Originally Posted by
Dave White
I'm really new to programming with SQL and still don't fully understand it, so looking for some help.
How can I program a script to change conduit pipe sizes based on the nominal sizes? For example, within the current selection, if the pipe is 2700mm, I want it reduced to 2550mm. If it's 1200mm I want it reduced to 1050mm, and so on. Having trouble using the CASE or IF statements, or maybe it should be some sort of loop through all the selected conduits? Any help is appreciated.
EDIT: I've been working on this and have the following code, but it only updates one of the selected conduits. (Storing the desired value in User Number 9 until I've got it all figured out)
LIST $NomPipe = 250,300,375,450,525,675,900,1050,1200,1350,1500,16 50,1800,2100,2400,2550,2700,3000;
LIST $ID STRING;
SELECT SELECTED DISTINCT oid INTO $ID FROM [Conduit];
LET $i=1;
WHILE $i<=LEN($ID);
DESELECT ALL;
SELECT FROM [All Links] WHERE oid=AREF($i,$ID);
SET $a = INDEX(conduit_width,$NomPipe);
UPDATE SELECTED SET user_number_9 = AREF($a - 1,$NomPipe);
LET $i=$i+1;
WEND;