Storing text in a Blob file and editing with external app.

jversusjjversusj Member Posts: 489
Hello all,
I have to accomodate a Web Description for Items that exceeds 800 characters (and may contain carriage returns) but is historically less than 1000.

I have done some research and some experiments, but now I am stuck.

Here is my current idea. I have created BLOB field on my table. When the user opens the form to view records from this table, I use an instream to return the value as a 1024 char text variable.

I then added a function button to "Edit Description" which will launch Notepad populated with the value (using the Integration with Notepad codeunit from the download section as an example of how to get started). Everything up to this point works.

The user makes changes in Notepad and saves their work. This should result in NAV storing the new text file in the BLOB field, but it is not working as hoped.
ImportNotePad()
IF NOT TempFile.OPEN(FORMAT(ENVIRON('TEMP')) + '\Notepad.txt') THEN
  TempFile.CREATE(FORMAT(ENVIRON('TEMP')) + '\Notepad.txt');
TempFile.CREATEINSTREAM(TempStream);

TempStream.READTEXT(sDescription,1024); 

Description.CREATEOUTSTREAM(TempOutStream);
TempOutStream.WRITE(sDescription);
MODIFY;

TempFile.CLOSE();

If i include a carriage return in my notepad text, anything after that carriage return is lost. I assume this is because of my READTEXT(variable,length) command? If I try to use READ(variable), i get the following error:
This message is for C/AL programmers:

The stream cannot find a zero-terminated string.
The stream may be invalid, or the (variable or requested) size may be too small.

I may be making this harder than it has to be. Does anyone have any tips for this? I just need to be able to store <1000 chars of text that includes carriage returns.

I saw the example solution for notepad integration used a "Line table" and it parsed the text into lines. This could be acceptable, but I was having issues with the Key.

I have a Web Family table. A family can have a family name and description for each customer that includes the item in their catalog. I was trying to have a compound key of Family ID (really just an Item No.) and Customer Division (Family: ABC and Division: XXX for example), but was having issues. Help with either approach would be greatly appreciated.
kind of fell into this...

Answers

  • jversusjjversusj Member Posts: 489
    disregard. I went back to using a line table and the existing notepad integration and resolved my key issues thus far. thank you.
    kind of fell into this...
Sign In or Register to comment.