21. November 2018 18:03
26. November 2018 09:07
26. November 2018 09:48
26. November 2018 11:46
PROCEDURE FullTextSearch@5041150(SearchTerms@5041150 : Text[50]) : Text[30];
VAR
countx@5041154 : Integer;
i@5041153 : Integer;
Statement@5041152 : Text[1024];
SearchX@5041151 : ARRAY [6] OF Text[30];
Setup@5041157 : Record 50018;
DBName@5041156 : Text[50];
CompanyName@5041155 : Text[50];
SQLQuery@5041158 : Text;
BEGIN
countx := STRLEN(DELCHR(SearchTerms, '<=>', DELCHR(SearchTerms,'<=>', '*')));
SearchTerms := CONVERTSTR(SearchTerms, '*', ',');
IF countx > 5 THEN
ERROR('Zu viele Suchbegriffe');
FOR i := 1 TO countx+1 DO BEGIN
SearchX[i] := SELECTSTR(i, SearchTerms);
END;
Statement := 'EXEC ft_itemsearch ''' + SearchX[1] + ''','''+SearchX[2]+''','''+SearchX[3]+''','''
+SearchX[4]+''','''+SearchX[5]+''','''+SearchX[6]+'''';
Setup.GET;
ConnectToDatabase(Setup."Server Name",Setup."DataBase Name",Setup."SQL User",Setup.Password);
IF DBName = '' THEN
DBName := Setup."DataBase Name";
IF CompanyName = '' THEN
CompanyName := Setup."Mandant Name";
ItemTmp.DELETEALL;
SQLCommand := SQLConnection.CreateCommand;
SQLCommand.CommandText := Statement;
SQLDataReader := SQLCommand.ExecuteReader();
ItemTmp.DELETEALL;
//Insert the resulting record set into a temporary table
WHILE SQLDataReader.Read() DO BEGIN
IF Item.GET(GetFieldValue(0)) THEN BEGIN
ItemTmp.INIT;
ItemTmp := Item;
ItemTmp.INSERT;
END;
END;
IF PAGE.RUNMODAL(0, ItemTmp) = ACTION::LookupOK THEN BEGIN
MESSAGE('Exit Text: ' + ItemTmp."No.");
EXIT(ItemTmp."No.");
END;
END;