Function getPartfilter (AID: String): String; // The unit head section is also defined.
VAR
QueryTemp: TOCEANQUERY;
String;
Lownerids: tstringlist;
Procedure getownerids (AID: String); // Can I use it without a definition???
Var lquery: TOCEANQUERY;
Begin
LQuery: = TOCEANQUERY.CREATE (NIL);
Try
LQuery.close;
LQuery.sql.text: = 'SELECT ID from partinfo where ownerid =' quotedstr (aid) 'and id <> quotedstr (aid) ' and imageindex = 0 ';
LQuery.open;
While not lquery.eof do
Begin
Lownerids.Add (lquery.fieldbyname ('ID'). asstring);
Getownerids (LQuery.fieldByName ('ID'). Asstring);
LQuery.next;
END;
Finally
LQuery.Free;
END;
END;
VAR i: integer;
Begin
Result: = '';
QueryTemp: = TOCEANQUERY.CREATE (NIL);
Lownerids: = TSTRINGLIST.CREATE;
Try
QueryTemp.close;
QueryTemp.sql.text: = 'SELECT ID, ImageINDEX from partinfo where id =' '' aid '' ';
QueryTemp.open;
IF querytemp.isempty kilod;
If QueryTemp.fieldByname ('ImageIndex'). Asinteger <> 0 THEN
Begin
Result: = 'id =' quotedstr (aid);
EXIT;
END;
Lownerids.add (querytemp.fieldbyname ('id'). asstring);
Getownerids (querytemp.fieldbyname ('ID'). Asstring;
For i: = 0 to lownerids.count - 1 do
Begin
if Result = '' THEN
Result: = 'Ownerid in (' quotedstr (lownerids [i])
Else
Result: = Result ',' quotedstr (lownerids [i]);
END;
If Result <> '' THEN
Result: = Result ')';
Finally
QueryTemp.free;
Lownerids.free;
END;
END;