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

jversusj
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.
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:
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.
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...
0
Answers
-
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...0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions