RTC notes

Hello All,

I am trying to save notes on RTC from Classic. I have written the code to do that and it works fine. The notes goes to Record Link table. On viewing from RTC I can see the note but if the comment is like 70 or more characters RTC gives an error on viewing it although the note exists in Record link table. What can be the issue? As I know blob field can store large data so number of characters shouldnt be a problem.

the code i am using something like this. There must be something wrong in code but it works for less characters of notes. Please help

outstream.WRITETEXT(Notes);
Recodlink.“Record ID”:=RecoRef.RECORDID;
Recordlink.Type:=Note.Type::Note;
Recordlink.“User ID”:=‘blahblah’;
Recordlink.Company:=‘TESTING’;
Recordlink.Created:=CREATEDATETIME(WORKDATE,TIME);
Recordlink.Description:=‘Customer Ledger Entries’;

Recordlink.INSERT

thanks.

Sorry my mistake. Upto 127 characters are fine. More than that it wouldnt accept. Again it does create a line in record link but doesnt show in RTC. While any thing 127 or less is fine.

thanks

I thought it would go up to 255, not 127.

You have to encode to bytes worth of data if the length of > 255 at the beginning of the note, instead of the one. 2^8 = 256, which is a byte;

Pseudo code:

IF NoteText.LENGTH <= 255 THEN BEGIN
Char1 := NoteText.LENGTH;
Note := FORMAT(Char1) + NoteText;
END ELSE BEGIN
Char1 := 128 + (NoteText.LENGTH - 256) MOD 128;
Char2 := 2 + (NoteText.LENGTH - 256) DIV 128;
Note := FORMAT(Char1) + FORMAT(Char2) + NoteText;
END;

Hi Matt. Thanks for your help but its not working for me. Still it only accepts 127 characters. I am not sure what to do. Please can you test it and help me with the exact code. Thanks.

I’ll go against my usual not flat out giving the code since it is a little confusing [:D]

This uses BigText, not Text, but you should be able to get the idea. TextToWrite is the BigText variable that holds the note with the length characters at the beginning. _Note is just the note itself, again BigText.

IF _Note.LENGTH <= 255 THEN BEGIN
Char1 := _Note.LENGTH;
TextToWrite.ADDTEXT(FORMAT(Char1));
END ELSE BEGIN
Char1 := 128 + (_Note.LENGTH - 256) MOD 128;
Char2 := 2 + (_Note.LENGTH - 256) DIV 128;
TextToWrite.ADDTEXT(FORMAT(Char1) + FORMAT(Char2));
END;
TextToWrite.ADDTEXT(_Note);

NewID := RecRef.ADDLINK(
‘dynamicsnav://///runpage?page=’ + FORMAT(PageID) +
‘&bookmark=’ + FORMAT(RecRef.RECORDID, 0, 10) +
‘&mode=view’, RecRef.NAME);

RecordLink.GET(NewID);
RecordLink.CALCFIELDS(Note);
RecordLink.Note.CREATEOUTSTREAM(OStream);
TextToWrite.WRITE(OStream);

Hi Matt,

Sorry for coming back late just been busy with some tasks :). Well I tried above solution and unfornately I am getting same result. The notes get stored in Record link table but when going to RTC and upon accessing that note the RTC crashes. But if the note is 127 characters or less it is fine.

Add also adding the URL of the page the RecordID should be in hex i guess , if not the link doesn’t work. so

NewID := RecRef.ADDLINK(
‘dynamicsnav://///runpage?page=’ + FORMAT(PageID) +
‘&bookmark=’ + FORMAT(RecRef.RECORDID, 0, 10) +
‘&mode=view’, RecRef.NAME);

the above bit doesnt work either.

Please if you can help further on both the issues it will be apreciated.

Thanks

The above code is working fine for me, so unfortunately I’m not sure what to tell you. You can download my Enhanced Notes solution from Mibuso and take a look at the CreateNotification function if you want. It should be in Page 50000 if I remember correctly.

http://mibuso.com/dlinfo.asp?FileID=1380

It would be good to know if my code also has some issues as I haven’t had the opportunity to test it on a wide variety of systems.

Hi thanks again. Well I have downloaded the Enhanced notes solutions and took the code in CreateNotification and still its not working. Is it because the code there is for NAV 2009 R2 and not for NAV 2009? As I am using NAV 2009. Is this might be the case?

Thanks,.

Maybe they changed how they did it between the service packs. It could be, but I don’t know why / how they would have changed it.

I see. Ok let us assume that NAV 2009 accepts 127 characters. Can you please help me to work out if characters more than 127 and maximim 250.

How we will then divide them between two characters? Can you please help me with that?

Thanks.

No need to assume. Go type in a note longer than 127 characters in the base notes system part. I’m pretty sure it would work as I’d like to think I would have remembered such a limitation.

It’s stored in the record link table as a blob, so you can then use a stream to export from the blob and see what the first few characters are.

Great:) . OK I have done that. The first character upside down L sign. and i cant past it here. it ‘L’ sign but upside down and right after this character the actual note begins. The note I enterred was 199 character long. What do you make of it?

Thanks alot

ok got its this character shown below.

Thanks.

You can use this function to determine what the integer value of that character is (my guess is 199).

Char c
Integer i

FOR i := 1 TO 255 DO BEGIN
c := i;
IF FORMAT(c) = FORMAT(first_character_from note) THEN
MESSAGE(i);
END;

A couple of other things. I don’t think you’ve posted your full code for creating the note. It might be helpful.

Also, create a note with the base notes part, then create that same note with your own code. Compare field by field to see if there are any differences.

My code is similar to yours. I tried to keep it same like yours as I could to make sure to make it work. Only thing is at first I am filtering a record where I want to put a note and then using RecRef.GETTABLE(Rec) like this:

CustLedgerEntry.RESET

CustLedgerEntry.SETRANGE(“Entry No.”,1212112)

CustledgerEntry.FIND(’-’)

RecRef.GETTABLE(CustLedgerEntry)

and after this same as your code.

Am I doing something wrong here?

I will try what you told me to do about the comparing the notes.

Thanks

OK I have compared adding my note and then adding same note to RTC directly. The difference was the first characters. Then I tried to replicate those characters on my note but nothing happens (RTC just crashes)

FORMAT(Recref.RECORDID, 0 ,10) for bookmark also not working. It doesnt return the special characters used for bookmark.

Help please.

OK I have compared adding my note and then adding same note to RTC directly. The difference was the first characters. Then I tried to replicate those characters on my note but nothing happens (RTC just crashes)

FORMAT(Recref.RECORDID, 0 ,10) for bookmark also not working. It doesnt return the special characters used for bookmark.

Help please.

OK I have compared adding my note and then adding same note to RTC directly. The difference was the first characters. Then I tried to replicate those characters on my note but nothing happens (RTC just crashes)

FORMAT(Recref.RECORDID, 0 ,10) for bookmark also not working. It doesnt return the special characters used for bookmark.

Help please.

Any comments on this issue from anyone please?

Thanks

That would lead me to believe that RecRef.RECORDID does not have the correct value in it. Has it been properly initialized?