Thursday, April 9, 2015
Error: The object file cannot be used with this version of the program
I am wondered when I tried to export object to folder, there was an error.....
After finding what the issue for few minutes......this was due to objects Nav 2013 were exist on that folder........
Wednesday, April 8, 2015
Navision 2 year digit date support 1930 - 2029
Navision support 2 digits year format from year 1930 to 2029. If you enter a number from 30 to 99 in the year portion of a date, Navision will interprete it as 19XX. If you enter the number from 00 to 29, Navision will interprete it as 20XX
Navision if using Native database can support date range from 0000 to 9999 while SQL Option can suppport date range from 1753 to 9999. If you want to enter any date out of the 1930 to 2029 ranges, you must enter the full 4 digit year format
Tuesday, April 7, 2015
Pseudocode - Read file from Navision
File Method:
FileName := 'D:\interface\';
FileRec.RESET;
FileRec.SETRANGE(Path,FileName);
FileRec.SETRANGE("Is a file",TRUE);
FileRec.SETFILTER(Name, '@*.TXT');
IF FileRec.FINDFIRST THEN
REPEAT
CLEAR(ImportFile);
ImportFile.TEXTMODE := TRUE;
ImportFile.WRITEMODE := FALSE;
ImportFile.OPEN(FileName + FileRec.Name);
FileSize := ImportFile.LEN;
CurrFilePos := ImportFile.POS;
WHILE(CurrFilePos <> FileSize) DO BEGIN
ImportFile.READ(TextLine);
FOR I := 1 TO STRLEN(TextLine) DO BEGIN
Chr := COPYSTR(TextLine,I,1);
MESSAGE(Chr);
END;
CurrFilePos := ImportFile.POS;
END;
ImportFile.CLOSE;
UNTIL FileRec.NEXT = 0;
Object:
OBJECT Codeunit 50051 Import Text - Stream Method
{
OBJECT-PROPERTIES
{
Date=08/04/15;
Time=[ 8:59:11 AM];
Modified=Yes;
Version List=MY.LAB;
}
PROPERTIES
{
OnRun=BEGIN
FileName := 'D:\interface\';
FileRec.RESET;
FileRec.SETRANGE(Path,FileName);
FileRec.SETRANGE("Is a file",TRUE);
FileRec.SETFILTER(Name, '@*.TXT');
IF FileRec.FINDFIRST THEN
REPEAT
CLEAR(ImportFile);
ImportFile.TEXTMODE := TRUE;
ImportFile.WRITEMODE := FALSE;
ImportFile.OPEN(FileName + FileRec.Name);
ImportFile.CREATEINSTREAM(StreamInText);
WHILE NOT (StreamInText.EOS()) DO BEGIN
StreamInText.READTEXT(TextLine);
FOR I := 1 TO STRLEN(TextLine) DO BEGIN
Chr := COPYSTR(TextLine,I,1);
MESSAGE(Chr);
END;
END;
ImportFile.CLOSE;
UNTIL FileRec.NEXT = 0;
END;
}
CODE
{
VAR
FileRec@1000000002 : Record 2000000022;
ImportFile@1000000001 : File;
FileName@1000000000 : Text[250];
TextLine@1000000005 : Text[1024];
FileSize@1000000004 : Integer;
CurrFilePos@1000000003 : Integer;
EntryNo@1000000007 : Integer;
Chr@1000000008 : Text[1];
I@1000000010 : Integer;
StreamInText@1000000009 : InStream;
BEGIN
END.
}
}
Stream Method:
FileName := 'D:\interface\';
FileRec.RESET;
FileRec.SETRANGE(Path,FileName);
FileRec.SETRANGE("Is a file",TRUE);
FileRec.SETFILTER(Name, '@*.TXT');
IF FileRec.FINDFIRST THEN
REPEAT
CLEAR(ImportFile);
ImportFile.TEXTMODE := TRUE;
ImportFile.WRITEMODE := FALSE;
ImportFile.OPEN(FileName + FileRec.Name);
ImportFile.CREATEINSTREAM(StreamInText);
WHILE NOT (StreamInText.EOS()) DO BEGIN
StreamInText.READTEXT(TextLine);
FOR I := 1 TO STRLEN(TextLine) DO BEGIN
Chr := COPYSTR(TextLine,I,1);
MESSAGE(Chr);
END;
END;
ImportFile.CLOSE;
UNTIL FileRec.NEXT = 0;
Object:
OBJECT Codeunit 50050 Import Text - File Method
{
OBJECT-PROPERTIES
{
Date=08/04/15;
Time=[ 8:59:01 AM];
Modified=Yes;
Version List=MY.LAB;
}
PROPERTIES
{
OnRun=BEGIN
FileName := 'D:\interface\';
FileRec.RESET;
FileRec.SETRANGE(Path,FileName);
FileRec.SETRANGE("Is a file",TRUE);
FileRec.SETFILTER(Name, '@*.TXT');
IF FileRec.FINDFIRST THEN
REPEAT
CLEAR(ImportFile);
ImportFile.TEXTMODE := TRUE;
ImportFile.WRITEMODE := FALSE;
ImportFile.OPEN(FileName + FileRec.Name);
FileSize := ImportFile.LEN;
CurrFilePos := ImportFile.POS;
WHILE(CurrFilePos <> FileSize) DO BEGIN
ImportFile.READ(TextLine);
FOR I := 1 TO STRLEN(TextLine) DO BEGIN
Chr := COPYSTR(TextLine,I,1);
MESSAGE(Chr);
END;
CurrFilePos := ImportFile.POS;
END;
ImportFile.CLOSE;
UNTIL FileRec.NEXT = 0;
END;
}
CODE
{
VAR
FileRec@1000000002 : Record 2000000022;
ImportFile@1000000001 : File;
FileName@1000000000 : Text[250];
TextLine@1000000005 : Text[1024];
FileSize@1000000004 : Integer;
CurrFilePos@1000000003 : Integer;
EntryNo@1000000007 : Integer;
Chr@1000000008 : Text[1];
I@1000000010 : Integer;
BEGIN
END.
}
}
Subscribe to:
Posts (Atom)