Unable to get data into .Net Add-in Navision 2013

oxillery
Member Posts: 7
Hi
I made a RichTextBox add-in to use in NAV 2013. I already tested this in the NAV 2009 R2 and it worked fine.
So what I did:
- Compile and sign the add-in
- Copy to Add-ins folder of NAV 7
- Register the add-in to the "Client Add-in" table (2000000069)
Then I created a table to store my notes called: "Contact Notes" where my data from my add-in will be stored in the field Content as a BLOB:
After that I made a CardPart:
Here I linked the Add-in to the Content field:
I add this cardPart to "My Customer Card" and set the relation so when you go to the next customer you corresponding note is opened.
Here is the code that is written in my add-in:
If I type some text in my textbox it will get stored in the database. I Checked this by looking in the table through MSSQL. I also checked the length of the byte array that was stored.
The problem I'm having is that when I open the page again, or move to another customer and then return, The previous stored data isn't returned. When I debug on the Set property it gets an array of length 8 and if you convert this to string it will be a square.
I have no idea what causes this problem or if I'm doing something wrong.
Thanks in advance
Oxillery
I made a RichTextBox add-in to use in NAV 2013. I already tested this in the NAV 2009 R2 and it worked fine.
So what I did:
- Compile and sign the add-in
- Copy to Add-ins folder of NAV 7
- Register the add-in to the "Client Add-in" table (2000000069)
Then I created a table to store my notes called: "Contact Notes" where my data from my add-in will be stored in the field Content as a BLOB:
After that I made a CardPart:
Here I linked the Add-in to the Content field:
I add this cardPart to "My Customer Card" and set the relation so when you go to the next customer you corresponding note is opened.
Here is the code that is written in my add-in:
[ControlAddInExport("Astena.RichTextboxEditor")] public class RichTextBoxAddin: WinFormsControlAddInBase, IObjectControlAddInDefinition { public NavPanel Panel; private bool Loaded = false; protected override Control CreateControl() { Debug.WriteLine("CreateControl(): Control Loading"); Panel = new NavPanel(); return Panel; } public bool HasValueChanged { get { Debug.WriteLine("Get: HasValueChanged = "+Panel.EditorChanged); //Debug return Panel.EditorChanged; } } public object Value { get { Debug.WriteLine("Get: Value"); //Debug Debug.WriteLine(Panel.EditorValue); Debug.WriteLine("Get: Value: Reset Loaded bool");//debug Loaded = false; Debug.WriteLine("Get: Reset HasChanged"); Panel.ResetEditorChanged(); return Encoding.UTF8.GetBytes(Panel.EditorValue); } set { Debug.WriteLine("Set: Start"); //Debug byte[] data = (byte[])value; string input = ""; if(data != null) input = Encoding.UTF8.GetString(data); Debug.WriteLine("Input.Legth: "+input.Length); Debug.WriteLine("Set: Value - Input:"); Debug.WriteLine(input); if (data != null && !Loaded) { Debug.WriteLine("Set: Value - Data != null && !Loaded"); //Debug //Debug.WriteLine("Set: Value - Input:");//Debug //Debug.WriteLine(input);//Debug if (input.Length > 75) //min rtf text length is 119 (including the headers) { Debug.WriteLine("Set: Value - Input.Length > 75"); Panel.EditorValue = Encoding.UTF8.GetString(data); Loaded = true; //only here is valuable data loaded } else { Debug.WriteLine("Set: Value - Input.Length > 75"); Panel.EditorValue = ""; } } Debug.WriteLine("Loaded: "+Loaded); } } public event ControlAddInEventHandler ControlAddIn; }
If I type some text in my textbox it will get stored in the database. I Checked this by looking in the table through MSSQL. I also checked the length of the byte array that was stored.
The problem I'm having is that when I open the page again, or move to another customer and then return, The previous stored data isn't returned. When I debug on the Set property it gets an array of length 8 and if you convert this to string it will be a square.
I have no idea what causes this problem or if I'm doing something wrong.
Thanks in advance
Oxillery
0
Comments
-
Are you doing CALCFIELDS on the BLOB field before it is passed into the addin?0
-
No I'm not doing a CALCFIELDS. Is that nessecary? Because I don't have any codeunit that handles the data or interacts whit the add-in.
The interface "IObjectControlAddInDefinition" should normally handle the data.
Is the way that BLOB data is handled changed in 2013?
EDIT: I took a closer look to the used code in the 2009 R2 and noticed that at some point a calcfields is used. I think you might be wright about the calcfields.0 -
Hello,
I have the exact same situation here.
Everything was OK on 2009R2 and now not working anymore with 2013.
In fact I can enter data and see that it is stored corectly by using Jet Report to access it. But when I try to read and display it on textBox add-in, i get a special character and then 7 squares instead of the proper text...
Any ideas ?
Thanks.0 -
Hi, I have the exact same problem.
But I also think that what we store is different.
Using the same object, saving the same text, what I see in sql in the blob is different for R2 and 2013.
Desperately need help!0 -
Blobs changes form 2009 to 2013, blobs are compressed by default and the compression method was a legacy nav method in <=2009, but now changed to .net Deflate method. Therefore the content is not the same. If a calcfields does not the trick, you could try to deflate the byte array by yourself? Maybe this helps. Here is an example of this: http://devch.wordpress.com/2013/01/17/accessing-compressed-blobs-from-outside-nav-nav2013/0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions