My question is, how can I read the text in documentation section (on top in source code editor). I'll create one report that shows all modified objects with that text.
In some cases it doesn't work. So I change the code a little. If you want I can send you the changed object. Then you can test which object works better with your database.
//
CLEAR(DocLine);
IsDoc := FALSE;
F.TEXTMODE := FALSE;
F.OPEN(FileName); //Open file with binary data for object (exported blob)
IsEnd := FALSE;
WHILE NOT IsEnd DO BEGIN //end of file or end of documentation
WasZero := IsOnlyZero;
IsOnlyZero := TRUE;
FOR i := 1 TO 4 DO BEGIN //read 4 bytes, if 00 00 00 00 then IsOnlyZero is true
IsEnd := F.READ(Chr)=0;
DWORD := Chr;
IsOnlyZero := IsOnlyZero AND (DWORD=0);
END;
// Check Doc begin and Doc LINE begin
IF WasZero AND ((DWORD[1] = 116) OR (DWORD[1]=115))
AND (DWORD[2] = 101) THEN BEGIN
// 00 00 00 00 73 65 ?? - begin of documentation or Doc Line
// 00 00 00 00 74 65 ??
IF (DWORD[3] = 68) OR (DWORD[3]=56) OR (DWORD[3]=88) OR (DWORD[3]=52) OR (DWORD[3]=48) THEN BEGIN
// ?? = 38|58 - begin of documentation
// ?? = 68|34
IsDoc := TRUE;
IsDocLine := TRUE;
END;
IF IsDoc THEN BEGIN // - DocLine
IsDocLine := TRUE;
END;
END
ELSE BEGIN
// Check Doc.END and Line.END
IF ((DWORD[1] = 24) OR (DWORD[1]=23)) AND (DWORD[2]=101) THEN BEGIN
// 18 65 ?? ?? or 17 65 ?? ?? is end of doc... if was doc
IF IsDocLine THEN BEGIN
HandleDocLine(IDNo,IDType,IDVersionList,DocLine); // insert new line into table (or somewhere)
DocLine := ''; // read new line
IF DWORD[1] = 23 THEN BEGIN // 17 65 ?? ?? is end of all documentation, end loop
IsEnd := TRUE;
IsDoc := FALSE;
END;
END;
IsDocLine := FALSE;
IsOnlyZero := TRUE;
END;
IF IsDocLine AND ((STRLEN(DocLine) + STRLEN(DWORD)) < MAXSTRLEN(DocLine)) THEN BEGIN
DocLine := DocLine + DWORD;
END;
END;
END;
F.CLOSE;
Some times i had special "?se" characters in my String to filter out this strings I have done a "quick and dirty" - change of the function:
HandleDocLine(IDNo : Integer;IDType : 'TableData,Table,Form,Report,Dataport,Codeunit';IDVersionList : Text[100];DocT : Text[1024])
LineLength := 250;
IF (STRLEN(DocText) + STRLEN(DocT) + 1) < MAXSTRLEN(DocText) THEN BEGIN
IF DocText <> '' THEN
DocText := DocText + '\';
DocText := DocText + DocT;
END;
SearchSub := ' ';
SearchSub[1] := 001;
LineText := DocT;
WHILE LineText <> '' DO BEGIN
SubLength := 0;
SubPos := STRPOS(LineText,SearchSub);
IF SubPos > 0 THEN BEGIN
SubLength := 1;
SubPos2 := STRPOS(LineText,SearchSub);
IF SubPos2 > 0 THEN BEGIN
SubPos := SubPos2;
SubLength := 4;
END;
END;
IF (STRLEN(LineText) >= LineLength) AND ((SubPos = 0) OR (SubPos >= LineLength)) THEN BEGIN
SubPos := LineLength;
SubLength := 0;
END;
IF SubPos > 0 THEN BEGIN // Sonderzeichen gefunden
InsertDocLine(IDNo,IDType,IDVersionList,COPYSTR(LineText,1,SubPos-1)); //insert new line into table (or somewhere)
LineText := str.Trim(COPYSTR(LineText, SubPos + SubLength, 1024));
END // if
ELSE BEGIN
InsertDocLine(IDNo,IDType, IDVersionList, LineText); //insert new line into table (or somewhere)
LineText := ''
END; // if Else
END;
Comments
In some cases it doesn't work. So I change the code a little. If you want I can send you the changed object. Then you can test which object works better with your database.
Ich habe das FOB jetzt etwas umgebaut, so das es mit Stream läuft und zu meinem Report passt.
Why didn't you write them into forum for the download? I am the author and do not know about the bugs to repair them...
I will update the download there...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
in InsertDocLine function.
I have the Problem that documentation witch starts with - won't be found.
So I change the function:
FindDoc(FileName : Text[1000];IDNo : Integer;IDType :
'TableData,Table,Form,Report,Dataport,Codeunit';IDVersionList : Text[100])
//
CLEAR(DocLine);
IsDoc := FALSE;
F.TEXTMODE := FALSE;
F.OPEN(FileName); //Open file with binary data for object (exported blob)
IsEnd := FALSE;
WHILE NOT IsEnd DO BEGIN //end of file or end of documentation
WasZero := IsOnlyZero;
IsOnlyZero := TRUE;
FOR i := 1 TO 4 DO BEGIN //read 4 bytes, if 00 00 00 00 then IsOnlyZero is true
IsEnd := F.READ(Chr)=0;
DWORD := Chr;
IsOnlyZero := IsOnlyZero AND (DWORD=0);
END;
// Check Doc begin and Doc LINE begin
IF WasZero AND ((DWORD[1] = 116) OR (DWORD[1]=115))
AND (DWORD[2] = 101) THEN BEGIN
// 00 00 00 00 73 65 ?? - begin of documentation or Doc Line
// 00 00 00 00 74 65 ??
IF (DWORD[3] = 68) OR (DWORD[3]=56) OR (DWORD[3]=88) OR (DWORD[3]=52) OR (DWORD[3]=48) THEN BEGIN
// ?? = 38|58 - begin of documentation
// ?? = 68|34
IsDoc := TRUE;
IsDocLine := TRUE;
END;
IF IsDoc THEN BEGIN // - DocLine
IsDocLine := TRUE;
END;
END
ELSE BEGIN
// Check Doc.END and Line.END
IF ((DWORD[1] = 24) OR (DWORD[1]=23)) AND (DWORD[2]=101) THEN BEGIN
// 18 65 ?? ?? or 17 65 ?? ?? is end of doc... if was doc
IF IsDocLine THEN BEGIN
HandleDocLine(IDNo,IDType,IDVersionList,DocLine); // insert new line into table (or somewhere)
DocLine := ''; // read new line
IF DWORD[1] = 23 THEN BEGIN // 17 65 ?? ?? is end of all documentation, end loop
IsEnd := TRUE;
IsDoc := FALSE;
END;
END;
IsDocLine := FALSE;
IsOnlyZero := TRUE;
END;
IF IsDocLine AND ((STRLEN(DocLine) + STRLEN(DWORD)) < MAXSTRLEN(DocLine)) THEN BEGIN
DocLine := DocLine + DWORD;
END;
END;
END;
F.CLOSE;
Some times i had special "?se" characters in my String to filter out this strings I have done a "quick and dirty" - change of the function:
HandleDocLine(IDNo : Integer;IDType : 'TableData,Table,Form,Report,Dataport,Codeunit';IDVersionList : Text[100];DocT : Text[1024])
LineLength := 250;
IF (STRLEN(DocText) + STRLEN(DocT) + 1) < MAXSTRLEN(DocText) THEN BEGIN
IF DocText <> '' THEN
DocText := DocText + '\';
DocText := DocText + DocT;
END;
SearchSub := ' ';
SearchSub[1] := 001;
LineText := DocT;
WHILE LineText <> '' DO BEGIN
SubLength := 0;
SubPos := STRPOS(LineText,SearchSub);
IF SubPos > 0 THEN BEGIN
SubLength := 1;
SearchSub := 'xxx';
SearchSub[1] := 001;
SearchSub[2] := 115;
SearchSub[3] := 101;
SubPos2 := STRPOS(LineText,SearchSub);
IF SubPos2 > 0 THEN BEGIN
SubPos := SubPos2;
SubLength := 4;
END;
END;
IF (STRLEN(LineText) >= LineLength) AND ((SubPos = 0) OR (SubPos >= LineLength)) THEN BEGIN
SubPos := LineLength;
SubLength := 0;
END;
IF SubPos > 0 THEN BEGIN // Sonderzeichen gefunden
InsertDocLine(IDNo,IDType,IDVersionList,COPYSTR(LineText,1,SubPos-1)); //insert new line into table (or somewhere)
LineText := str.Trim(COPYSTR(LineText, SubPos + SubLength, 1024));
END // if
ELSE BEGIN
InsertDocLine(IDNo,IDType, IDVersionList, LineText); //insert new line into table (or somewhere)
LineText := ''
END; // if Else
END;
I hope I have done the reporting now correctly