Open Forum

Expand all | Collapse all

Notes display only first 65 characters when created with code

  • 1.  Notes display only first 65 characters when created with code

    TOP CONTRIBUTOR
    Posted Sep 04, 2018 01:47 PM
    Edited by Greg Enns Sep 04, 2018 02:06 PM
    We use code to auto-generate some notes on documents.
    Longer notes are not displayed in their entirety--with the limit seeming to be around 60-65 characters.
    I can use Jet to look at the note as it is stored in the database...The note is there in it's entirety (131 characters)! Why won't NAV show me the whole note in the UI?
    I can copy/paste MUCH longer than that in the UI and it shows up fine.

    The essentials of the code for the note creation are:
    RecLink.Note.CREATEOUTSTREAM(OutStream1);
    OutStream1.WRITETEXT(MessageText);
    RecLink.Created := CURRENTDATETIME;
    RecLink."User ID" := USERID;
    RecLink.Company := COMPANYNAME;
    RecLink.INSERT(TRUE);

    (This is NAV 2016.)
    ------------------------------
    Greg Enns
    ERP Coordinator
    Technical Prospects
    Kaukauna WI
    ------------------------------


  • 2.  RE: Notes display only first 65 characters when created with code

    GOLD CONTRIBUTOR
    Posted Sep 04, 2018 02:09 PM
    Greg,

    I am not sure if that is the reason but try encoding the text before assigning it. Check the function in my blog post

    http://www.navisionworld.com/2015/11/how-to-readwrite-notes-in-navision.html

    ------------------------------
    Thanks
    Suresh Kulla
    NAV Technical Architect
    Atlanta GA
    ------------------------------



  • 3.  RE: Notes display only first 65 characters when created with code

    TOP CONTRIBUTOR
    Posted Sep 04, 2018 03:08 PM
    Unfortunately no--that didn't fix it. Thanks for the idea though--definitely worth a shot.

    ------------------------------
    Greg Enns
    ERP Coordinator
    Technical Prospects
    Kaukauna WI
    ------------------------------



  • 4.  RE: Notes display only first 65 characters when created with code

    SILVER CONTRIBUTOR
    Posted Sep 05, 2018 03:16 AM
    Try this:

    RecLink.Note.CREATEOUTSTREAM(OutStream);
    BinStream := BinStream.BinaryWriter(OutStream, TextEncoder.UTF8);
    BinStream.Write(TextNoteHere);

    Where:
    BinStream is a DotNet variable of type System.IO.BinaryWriter
    TextEncoder is a DotNet variable of type System.Text.Encoding

    ------------------------------
    Mark Hamblin
    Insight Works
    Edmonton AB
    ------------------------------



  • 5.  RE: Notes display only first 65 characters when created with code

    TOP CONTRIBUTOR
    Posted Sep 06, 2018 09:40 AM
    Thanks Mark! That did it!

    ------------------------------
    Greg Enns
    ERP Coordinator
    Technical Prospects
    Kaukauna WI
    ------------------------------