IF InputFile.OPEN(FileNameIn) THEN BEGIN InputFile.READ(TNumber); WHILE TNumber <> 'QUIT' DO BEGIN ProgWin.UPDATE; MyItem.SETFILTER("No.",TNumber); IF (MyItem.FIND('-') = TRUE) THEN BEGIN OutputLine := MyItem."No." + '~' + FORMAT(MyItem."Unit Price"); OutputFile.WRITE(OutputLine); Number := Number + 1; InputFile.READ(TNumber); END ELSE ERROR(NoItemNumber, TNumber); END; END ELSE ERROR(NoFile, FileNameIn);
Comments
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Also works
But I like the streams.
The File.POS and File.LEN are very slow!
So it is better to calculate the POS manually.
But of course: streams are an good alternative.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
It means, if you test the result of the reading and the result is =0 it means, there are no more data to read (you are on the end of file).
Common construction:
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Also the way he has written the code he is not settng this property. So
InputFile.READ(TNumber) will read the whole file. the first time and will have an overflow error.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.