OBJECT Report 59003 Create Table Definition File
{
OBJECT-PROPERTIES
{
}
PROPERTIES
{
CaptionML=ENU=Create Table Definition File;
ProcessingOnly=Yes;
OnPostReport=VAR
NAVObjectFile@1014 : File;
TextLine@1001 : Text;
TempTextLine@1009 : Text;
OutputTextLine@1008 : Text;
TableObjectFound@1004 : Boolean;
PropertiesTagFound@1003 : Boolean;
ObjectPropertiesTagFound@1113900000 : Boolean;
FieldsTagFound@1005 : Boolean;
KeyTagFound@1013 : Boolean;
OptionFieldFound@1000 : Boolean;
FieldType@1010 : Text[30];
FieldProperty@1011 : Text[30];
Counter@1006 : Integer;
FieldTagCounter@1007 : Integer;
FieldTagDelimiterPosition@1002 : Integer;
FieldPropertyDelimiterPosition@1012 : Integer;
BEGIN
IF NAVObjectFileName <> '' THEN BEGIN
IF NOT FileManagement.ServerFileExists(NAVObjectFileName) THEN
ERROR(Text004,NAVObjectFileName);
NAVObjectFile.TEXTMODE := TRUE;
NAVObjectFile.OPEN(NAVObjectFileName);
OutputFile.WRITEMODE := TRUE;
OutputFile.TEXTMODE := TRUE;
IF LOWERCASE(COPYSTR(NAVObjectFileName,STRLEN(NAVObjectFileName))) = '.txt' THEN
NAVObjectFileName := COPYSTR(NAVObjectFileName,1, STRLEN(NAVObjectFileName) - 4);
OutputFile.CREATE(NAVObjectFileName + 'TableDefinitionOnly.txt');
//MergeDialogMgt.OpenDialog(Text001,0);
WHILE NAVObjectFile.POS <> NAVObjectFile.LEN DO BEGIN
NAVObjectFile.READ(TextLine);
IF COPYSTR(TextLine,1,6) = 'OBJECT' THEN BEGIN
EndObject;
TableObjectFound := COPYSTR(TextLine,1,12) = 'OBJECT Table';
IF TableObjectFound THEN BEGIN
//MergeDialogMgt.UpdateDialog(1,TextLine);
OutputFile.WRITE(TextLine);
OutputFile.WRITE('{');
END;
END;
IF TableObjectFound THEN BEGIN
IF NOT ObjectPropertiesTagFound AND NOT DeleteObjectProperties THEN
ObjectPropertiesTagFound := COPYSTR(TextLine,1,19) = ' OBJECT-PROPERTIES';
IF ObjectPropertiesTagFound THEN BEGIN
OutputFile.WRITE(TextLine);
IF COPYSTR(TextLine,1,3) = ' }' THEN
ObjectPropertiesTagFound := FALSE;
END;
IF NOT PropertiesTagFound THEN
PropertiesTagFound := COPYSTR(TextLine,1,12) = ' PROPERTIES'
ELSE
IF COPYSTR(TextLine,1,18) = ' DataPerCompany' THEN BEGIN
OutputFile.WRITE(' PROPERTIES');
OutputFile.WRITE(' {');
OutputFile.WRITE(TextLine);
OutputFile.WRITE(' }');
END ELSE
PropertiesTagFound := COPYSTR(TextLine,1,18) <> ' }';
IF NOT KeyTagFound THEN BEGIN
KeyTagFound := COPYSTR(TextLine,1,6) = ' KEYS';
IF KeyTagFound THEN
OutputFile.WRITE(TextLine);
END ELSE
IF COPYSTR(TextLine,1,5) = ' }' THEN BEGIN
OutputFile.WRITE(TextLine);
KeyTagFound := FALSE
END ELSE
OutputFile.WRITE(TextLine);
IF NOT FieldsTagFound THEN BEGIN
FieldsTagFound := COPYSTR(TextLine,1,8) = ' FIELDS';
IF FieldsTagFound THEN BEGIN
OutputFile.WRITE(TextLine);
OutputFile.WRITE(' {');
END;
END;
IF FieldsTagFound THEN
CASE TRUE OF
COPYSTR(TextLine,1,5) = ' {':
BEGIN
TempTextLine := TextLine;
OutputTextLine := '';
OptionFieldFound := FALSE;
FieldType := '';
FieldProperty := '';
FieldPropertyDelimiterPosition := 0;
FOR FieldTagCounter := 1 TO 5 DO BEGIN
// { FieldNo;Enabled;FieldName;DataType
// OptionString
// FieldClass
// { 6 ; ;Bill of Materials ;Boolean ;FieldClass=FlowField;
FieldTagDelimiterPosition := STRPOS(TempTextLine,';');
CASE FieldTagCounter OF
1: OutputTextLine := OutputTextLine + COPYSTR(TempTextLine,1,FieldTagDelimiterPosition); // Field No
2: OutputTextLine := OutputTextLine + COPYSTR(TempTextLine,1,FieldTagDelimiterPosition); // Enabled
3: OutputTextLine := OutputTextLine + COPYSTR(TempTextLine,1,FieldTagDelimiterPosition); // Field Name
4: // Data Type
IF FieldTagDelimiterPosition > 0 THEN BEGIN
FieldType := COPYSTR(TempTextLine,1,FieldTagDelimiterPosition - 1);
FieldType := DELCHR(FieldType,'>',' ');
OutputTextLine := OutputTextLine + COPYSTR(TempTextLine,1,FieldTagDelimiterPosition);
END ELSE
OutputTextLine := TextLine;
5: // Field Property
BEGIN
FieldPropertyDelimiterPosition := STRPOS(TempTextLine,'=');
IF FieldPropertyDelimiterPosition > 0 THEN BEGIN
FieldProperty := COPYSTR(TempTextLine,1,FieldPropertyDelimiterPosition - 1);
IF IsExtraFieldProperty(FieldProperty) THEN
OutputTextLine := TextLine;
END;
END;
END;
TempTextLine := COPYSTR(TempTextLine,FieldTagDelimiterPosition + 1);
END;
WriteLine(OutputTextLine,FALSE);
END;
COPYSTR(TextLine,1,3) = ' }':
BEGIN
FieldsTagFound := FALSE;
OutputFile.WRITE(TextLine);
END;
ELSE BEGIN
TempTextLine := COPYSTR(TextLine,52); // Start Field Property
FieldPropertyDelimiterPosition := STRPOS(TempTextLine,'=');
IF FieldPropertyDelimiterPosition > 0 THEN BEGIN
IF STRLEN(COPYSTR(TempTextLine,1,FieldPropertyDelimiterPosition - 1)) <= MAXSTRLEN(FieldProperty) THEN BEGIN
FieldProperty := COPYSTR(TempTextLine,1,FieldPropertyDelimiterPosition - 1);
IF IsExtraFieldProperty(FieldProperty) THEN BEGIN
OutputTextLine := TextLine;
WriteLine(OutputTextLine,TRUE);
END;
END;
END;
END;
END;
END;
END;
IF TableObjectFound THEN
EndObject;
//MergeDialogMgt.CloseDialog;
OutputFile.CLOSE;
NAVObjectFile.CLOSE;
END;
END;
}
DATASET
{
}
REQUESTPAGE
{
PROPERTIES
{
}
CONTROLS
{
{ 1 ; ;Container ;
ContainerType=ContentArea }
{ 2 ;1 ;Group ;
GroupType=Group }
{ 3 ;2 ;Field ;
CaptionML=ENU=NAV-Object Filename;
SourceExpr=NAVObjectFileName;
OnAssistEdit=VAR
FileManagement@1000 : Codeunit 419;
BEGIN
NAVObjectFileName := FileManagement.OpenFileDialog('',NAVObjectFileName,'');
END;
}
{ 4 ;2 ;Field ;
CaptionML=ENU=Delete Object Properties;
SourceExpr=DeleteObjectProperties }
}
}
LABELS
{
}
CODE
{
VAR
Text001@1003 : TextConst 'ENU=Creating Table Definition File...\\#1##########';
Text002@1002 : TextConst 'ENU=Text Files (*.txt)|*.txt|All Files (*.*)|*.*';
FileManagement@1000000001 : Codeunit 419;
OutputFile@1006 : File;
NAVObjectFileName@1001 : Text[1024];
DeleteObjectProperties@1004 : Boolean;
Text004@1000000000 : TextConst 'ENU=Object File %1 does not exist.';
LOCAL PROCEDURE WriteLine@1(OutputTextLine@1002 : Text[1024];AddExtraProprty@1001 : Boolean);
BEGIN
// Remove ; or } at the end
OutputTextLine := DELCHR(OutputTextLine,'>',';}');
OutputTextLine := OutputTextLine + '}';
IF AddExtraProprty THEN BEGIN
OutputFile.SEEK(OutputFile.POS - 3);
OutputFile.WRITE(';');
END;
OutputFile.WRITE(OutputTextLine);
END;
LOCAL PROCEDURE EndObject@2();
BEGIN
IF OutputFile.POS > 0 THEN
OutputFile.WRITE('}'); // End previous table object
END;
LOCAL PROCEDURE IsExtraFieldProperty@3(FieldProperty@1000 : Text[30]) : Boolean;
BEGIN
EXIT(FieldProperty IN ['OptionString','FieldClass']);
END;
BEGIN
END.
}
RDLDATA
{
}
}