Notifications
Announcements
No record found.
Hello guys .I have to modify a note related to a specific record in nav. It is a blob .Any ideas on how to get the actual note , modify it and save the new note.Thanks in advance.
*This post is locked for comments
Read here:
community.dynamics.com/.../how-to-read-write-notes-in-navision-using-c-al
Hello I have that code already because i needed that too.I am having problems with modifying.Thanks however
Hi,
I have used this code to modify blob content in a page as a text variable
Name DataType SubtypeTextVar Text InStr InStream OutStr OutStreamBuffer TextBinaryReader DotNet System.IO.BinaryReader.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'BinaryWriter DotNet System.IO.BinaryWriter.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'Encoding DotNet System.Text.Encoding.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
//Set BLOB value into TextVar CALCFIELDS("Your BLOB"); "Your BLOB".CREATEINSTREAM(InStr); BinaryReader := BinaryReader.BinaryReader(InStr, Encoding.UTF8); IF NOT ISNULL(BinaryReader) THEN BEGIN IF BinaryReader.BaseStream.Length > 0 THEN TextVar := BinaryReader.ReadString; BinaryReader.Close; END; // TODO: Make your modifications in TextVar
//Set TextVar value into BLOB CLEAR("Your BLOB"); "Your BLOB".CREATEOUTSTREAM(OutStr); BinaryWriter := BinaryWriter.BinaryWriter(OutStr,Encoding.UTF8); BinaryWriter.Write(TextVar); BinaryWriter.Close;
//Show BLOB valueCALCFIELDS("Your BLOB");MESSAGE(FORMAT("Your BLOB"));
What problems you are having, you need to read the note using the method provided in the above link and modify it.
I have the following queue. I should click Edit and it opens the edit subpage where i type the new text. When i click Ok it shoul update the Notes Factbox. Test Note should convert to the text i enter in the Edit form. But the problem i have is it doesnt update :/
Thank you for your above help.
I entered the Read Text at Edit action and the write to On query close page of the own page.The code is above :
OnQueryClosePage(CloseAction : Action None) : Boolean
IF CloseAction IN [ACTION::OK] THEN
BEGIN
RecRef.GETTABLE(Product);
IF Product.FINDFIRST THEN
RecordLink.RESET;
RecordLink.SETRANGE("Record ID",Product.RECORDID);
IF RecordLink.FINDFIRST THEN
IF Notes <> '' THEN
Rec.Note.CREATEOUTSTREAM(outStr);
BinaryWriter := BinaryWriter.BinaryWriter(outStr,Encoding.UTF8);
BinaryWriter.Write(Notes);
Rec.MODIFY();
BinaryWriter.Close;
CALCFIELDS(Note);
//MESSAGE(FORMAT(Note));
END;
CurrPage.UPDATE(TRUE);
EditNotes - OnAction()
//MESSAGE('Implementare funzionalità ');
PAGE.RUN(51266);
RecordLink.GET("Link ID");
IF RecordLink.FINDFIRST THEN BEGIN
RecordLink.CALCFIELDS(Note);
Rec.Note.CREATEINSTREAM(Stream);
BinaryReader := BinaryReader.BinaryReader(Stream,Encoding.UTF8);
IF NOT ISNULL(BinaryReader) THEN BEGIN
IF BinaryReader.BaseStream.Length > 0 THEN
Notes := BinaryReader.ReadString;
BinaryReader.Close;
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.