AL icon indicating copy to clipboard operation
AL copied to clipboard

error AL0296. Need File Management, RapidStart Config Package Mgmt, CSV Buffer LoadData Methods External

Open jaadkins81 opened this issue 8 years ago • 7 comments

V1 blocking issues for our Data Migrator:

  • error AL0296: The type or method 'InsertPackageField' cannot be used for 'Extension' development. (CU 8611 "Config. Package Management")
  • error AL0296: The type or method 'ApplyPackage' cannot be used for 'Extension' development. (CU 8611 "Config. Package Management")
  • error AL0296: The type or method 'UploadFile' cannot be used for 'Extension' development. (CU 419 “File Management”)
  • error AL0296: The type or method 'LoadData' cannot be used for 'Extension' development. (table 1234 "CSV Buffer")
  • error AL0296: The type or method 'RecordError' cannot be used for 'Extension' development.( 8611 "Config. Package Management")

If refactoring, please try to keep the method signature in sync if possible.

jaadkins81 avatar Jan 13 '18 01:01 jaadkins81

Unfortunately, I cannot expose UploadFile, as files aren't supported in V2 extensions. Instead, you will have to use file streams. This is also true for LoadData; I will add a function to load data from stream, which should do the trick. Your remaining 3 requests have been addressed.

JesperSchulz avatar Jan 16 '18 17:01 JesperSchulz

I can read text from the Instream Object that I pass to your LoadDataFromStream function. However, your first check in your ReadLines function (StreamReader.EndOfStream) returns true so the function exits and no data is processed.

I am using the UpLoadIntoStream function to create the Instream object.

-- from Table 1234...

LoadDataFromStream(CSVInStream : InStream;CSVFieldSeparator : Text) InitializeReaderFromStream(CSVInStream,CSVFieldSeparator); ReadLines(0); StreamReader.Close;

-- ReadLines(NumberOfLines : Integer) : Boolean IF StreamReader.EndOfStream THEN EXIT(FALSE); ...

jaadkins81 avatar Jan 24 '18 19:01 jaadkins81

Hi, I did not manage to repro your issue. Here is the code I used to try to repro: local procedure TestCSV() var MyInStream : InStream; UploadResult : Boolean; TempBlob : Record TempBlob; DialogCaption : Text; Name : Text; CSVBuffer: Record "CSV Buffer"; begin UploadResult := UploadIntoStream(DialogCaption,'','',Name,MyInStream); CSVBuffer.DeleteAll; CSVBuffer.LoadDataFromStream(MyInStream,';'); Message('%1 contains %2 lines.', Name, Format(CSVBuffer.Count)); end; image

Maybe you are reading the stream twice and the second time, it fails because it is already at the end of the stream?

DavidBastide avatar Jan 25 '18 10:01 DavidBastide

David, Jesper, Because I copied the stream before I called the LoadDataFromStream, it moved the pointer to EOS. I was able to track this down immediately after reading your suggestions. Thanks again to both of you for your help.

CopyStream(OutStream,locInstream); //evidently sets locInstream.EOS := true TempCSVBuffer.LoadDataFromStream(locInStream,Tab);

jaadkins81 avatar Jan 25 '18 22:01 jaadkins81

Stanislaw - why reopen?

jaadkins81 avatar Feb 14 '18 14:02 jaadkins81

February update hasn't shipped yet. We only close fixes once they are publicly available.

StanislawStempin avatar Feb 14 '18 15:02 StanislawStempin

ok thanks.

jaadkins81 avatar Feb 14 '18 16:02 jaadkins81