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
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
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
BEGIN
RecordLink.RESET;
RecordLink.SETRANGE("Record ID",Product.RECORDID);
IF RecordLink.FINDFIRST THEN
BEGIN
IF Notes <> '' THEN
BEGIN
Rec.Note.CREATEOUTSTREAM(outStr);
BinaryWriter := BinaryWriter.BinaryWriter(outStr,Encoding.UTF8);
BinaryWriter.Write(Notes);
Rec.MODIFY();
BinaryWriter.Close;
CALCFIELDS(Note);
//MESSAGE(FORMAT(Note));
END;
END;
END;
CurrPage.UPDATE(TRUE);
END;
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;
END;
END;
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.
What problems you are having, you need to read the note using the method provided in the above link and modify it.
Hi,
I have used this code to modify blob content in a page as a text variable
Name DataType Subtype
TextVar Text InStr InStream
OutStr OutStream
Buffer Text
BinaryReader 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 value
CALCFIELDS("Your BLOB");
MESSAGE(FORMAT("Your BLOB"));
Hello
I have that code already because i needed that too.I am having problems with modifying.
Thanks however
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,214 Most Valuable Professional
nmaenpaa 101,156