{"id":893,"date":"2011-05-09T17:09:54","date_gmt":"2011-05-10T00:09:54","guid":{"rendered":"http:\/\/45.63.48.66\/?p=893"},"modified":"2019-05-02T14:36:23","modified_gmt":"2019-05-02T21:36:23","slug":"dynamics-nav-rtc-reports-blob-fields-printing-notifications","status":"publish","type":"post","link":"https:\/\/gotcal.com\/index.php\/2011\/05\/dynamics-nav-rtc-reports-blob-fields-printing-notifications\/","title":{"rendered":"Dynamics NAV RTC Reports, BLOB fields, printing Notifications"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-899\" title=\"postitnote\" src=\"http:\/\/gotcal.com\/wp-content\/uploads\/2011\/04\/postitnote.jpg\" alt=\"\" width=\"224\" height=\"177\">In Dynamics NAV 2009 RTC you have the new functionality with Notifications. It allows you to create notifications and send them to other users, so it shows up in their &#8220;My Notification&#8221; on the Role Center. The notifications are actually stored in the &#8220;Record Link&#8221; table as a BLOB field.<\/p>\n<p>This is a great functionality, but as it is now, you can only see the notes from the My Notifications and the notification fact boxes. In this blog post i will take a look at how you can print these notes in a RTC\/RDLC report.<\/p>\n<p>Lets take&nbsp; closer look at what is stored:<\/p>\n<p><!--more--><\/p>\n<p>In the table lets take a look at some of the fields that tell us we are dealing with a Notification:<\/p>\n<ul>\n<li>Type=Notification<\/li>\n<li>Notify, boolean that tells us if another user is to be notified<\/li>\n<li>To User ID, the User ID of the user to receive the notification<\/li>\n<\/ul>\n<p>The actual data for the note is stored in the Note (BLOB) field. To get this to print on a report, lets just create a quick and simple report layout in the report designer. Just add the Note field (remember you need a CALCFIELDS on it) and put in the sourceexpression of a textbox in your report. On the RTC\/RDLC report just add the new field and then test the report.<\/p>\n<p>As you will notice it just prints: &#8220;#ERROR&#8221;. Hmm! This is due to the way the Note is stored in the database. The RTC clients writes the note through a BinaryWriter: <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/yzxa6408.aspx\">http:\/\/msdn.microsoft.com\/en-us\/library\/yzxa6408.aspx<\/a>. As you can see the first bytes tells us the length of the string, and the remaining data is what we need to actually look at. In .NET that is very simple, just write a function to do that:<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Public Function Convert2String(Value As Byte()) As String\nTry\nIf Value.Length = 0 Then\nReturn \"\"\nEnd If\nDim utf8 As System.Text.UTF8Encoding = New System.Text.UTF8Encoding()\nDim mem As New System.IO.MemoryStream()\nmem.Write(Value, 0, Value.Length)\nmem.Seek(0, System.IO.SeekOrigin.Begin)\nDim reader As New System.IO.BinaryReader(mem, utf8)\nReturn reader.ReadString()\nCatch ex As Exception\nReturn ex.Message\nEnd Try\n\nEnd Function\n<\/pre>\n<p>As i usually code in C# and the RTC reports to my knowledge only works with VB.NET code i am using a neat little conversion tool, that can be found here: <a href=\"http:\/\/www.developerfusion.com\/tools\/convert\/csharp-to-vb\/\">http:\/\/www.developerfusion.com\/tools\/convert\/csharp-to-vb\/<\/a>. Also information for how the text is stored in the BLOB was found here: <a href=\"http:\/\/www.mibuso.com\/forum\/viewtopic.php?t=43416\">http:\/\/www.mibuso.com\/forum\/viewtopic.php?t=43416<\/a><\/p>\n<blockquote><p><strong>TIP 1<\/strong>: Using the Try\/Catch structure in the code, has been a great help in &#8220;debugging&#8221; my code in the RTC reports, as it would actually return any error messages from the Try section in the TextBox on the report, as well as help you figure out what Object data you are working with.<\/p><\/blockquote>\n<blockquote><p><strong>TIP 2<\/strong>: To make sure the code you have written in the RTC report can compile, you can do a build while you are in Visual Studio. Or just use the shortcust CTRL+B. That way you dont have to first save the report and wait for NAV to compile the code and return any errors.<\/p><\/blockquote>\n<p>In my next blog post, i will show you how to use the RTC notes in the classic client and NAS.<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>In Dynamics NAV 2009 RTC you have the new functionality with Notifications. It allows you to create notifications and send them to other users, so it shows up in their &#8220;My Notification&#8221; on the Role Center. The notifications are actually stored in the &#8220;Record Link&#8221; table as a BLOB field. This is a great functionality, [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[62,3,53,69],"tags":[78,39,15,19],"class_list":["post-893","post","type-post","status-publish","format-standard","hentry","category-net","category-navision","category-rtc-2","category-tipstricks","tag-net","tag-programming","tag-report","tag-rtc"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts\/893","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/comments?post=893"}],"version-history":[{"count":32,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts\/893\/revisions"}],"predecessor-version":[{"id":1006,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts\/893\/revisions\/1006"}],"wp:attachment":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/media?parent=893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/categories?post=893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/tags?post=893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}