Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Modifications of Notes of records

Posted on by Microsoft Employee

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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Modifications of Notes of records

    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;

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Modifications of Notes of records

    me-ngjyrA.PNGI 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.

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Modifications of Notes of records

    What problems you are having, you need to read the note using the method provided in the above link and modify it.

  • Suggested answer
    Guillem Padilla Profile Picture
    Guillem Padilla 425 on at
    RE: Modifications of Notes of records

    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"));
  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Modifications of Notes of records

    Hello 
    I have that code already because i needed that too.I am having problems with modifying.
    Thanks however

  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: Modifications of Notes of records

    Read here:

    community.dynamics.com/.../how-to-read-write-notes-in-navision-using-c-al

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.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans