Is Notes from subform possible?

SunsetSunset Posts: 157Member
Is it possible to get the System-Notes to use the record displayed on the subform as reference? I've tried using the ProviderID, but it gets ignored.

For instance if you are standing in the salesorder, and you want a factbox showing the notes related to the item on the subformline. I know I can code a new page and use that, but I would prefer being able to use the System-Notes as that is what is used everywhere else.
Don't just take my word for it, test it yourself

Comments

  • Mark_SmartMark_Smart Posts: 16Member
    Short answer no. I ran into the same issue.

    Long answer is grab a coffee. Replicate the factbox as close as possible for source 2000000068 Record Link, with SourceTableView Type=Note. Have code to convert text from base64 (and I think you need to ignore the first character). Maintain the link to the factbox from subpage to the main page using a Record ID Flowfilter and OnAfterGetRecord triggers. Have the subform link Record ID with your flowfilter, and Company = CONST(%COMPANY%). The %COMPANY% constant replaces the string with current company name.

    Here's some code for the factbox:

    Var:
    NoteText BigText

    OnAfterGetRecord()
    CALCFIELDS(Note);
    IF Note.HASVALUE THEN BEGIN
    Note.CREATEINSTREAM(InStr);
    NoteText.READ(InStr);
    NoteText.GETSUBTEXT(NoteText,2);
    END ELSE
    CLEAR(NoteText);


    LOCAL WriteNoteText(NoteText : BigText;VAR RecordLink : Record "Record Link")
    Local Vars:
    SystemUTF8Encoder DotNet System.Text.UTF8Encoding.'mscorlib'
    SystemByteArray DotNet System.Array.'mscorlib'
    OStr OutStream
    s BigText
    lf Text
    x Integer
    y Integer
    i Integer
    c1 Char
    c2 Char

    s := NoteText;
    SystemUTF8Encoder := SystemUTF8Encoder.UTF8Encoding;
    SystemByteArray := SystemUTF8Encoder.GetBytes(s);
    RecordLink.Note.CREATEOUTSTREAM(OStr);
    x := SystemByteArray.Length DIV 128;
    IF x > 1 THEN
    y := SystemByteArray.Length - 128 * (x - 1)
    ELSE
    y := SystemByteArray.Length;
    c1 := y;
    OStr.WRITE(c1);
    IF x > 0 THEN BEGIN
    c2 := x;
    OStr.WRITE(c2);
    END;
    FOR i := 0 TO SystemByteArray.Length - 1 DO BEGIN
    c1 := SystemByteArray.GetValue(i);
    OStr.WRITE(c1);
    END;

    <\code>

    Good luck!
Sign In or Register to comment.