Automation ArrayList in NAV 2013 R2

navuser1
Member Posts: 1,334
Dear All,
How do I read the ArrayList of a custom dll in NAV 2013 R2 Environment ?
Please reply.
How do I read the ArrayList of a custom dll in NAV 2013 R2 Environment ?
Please reply.
Now or Never
0
Comments
-
Look that :
Name DataType Subtype Length
NETArray DotNet System.Array.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
NETTYpe DotNet System.Type.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
NETConvert DotNet System.Convert.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
NETBufferLocal := NETBufferLocal.GetType('System.Buffer',FALSE);
NETTYpeLocal := NETTYpeLocal.GetType('System.Byte',FALSE);
NETArrayLocal := NETArrayLocal.CreateInstance(NETTYpeLocal, XMLText.LENGTH);
NETArrayLocal := Encoding.UTF8.GetBytes(XMLText);
MemoryStreamLocal := MemoryStream.MemoryStream(NETArrayLocal);
MemoryStreamLocal.Flush();
MemoryStreamLocal.Position := 0;0 -
massimopasquali wrote:Look that :
Name DataType Subtype Length
NETArray DotNet System.Array.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
NETTYpe DotNet System.Type.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
NETConvert DotNet System.Convert.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
NETBufferLocal := NETBufferLocal.GetType('System.Buffer',FALSE);
NETTYpeLocal := NETTYpeLocal.GetType('System.Byte',FALSE);
NETArrayLocal := NETArrayLocal.CreateInstance(NETTYpeLocal, XMLText.LENGTH);
NETArrayLocal := Encoding.UTF8.GetBytes(XMLText);
MemoryStreamLocal := MemoryStream.MemoryStream(NETArrayLocal);
MemoryStreamLocal.Flush();
MemoryStreamLocal.Position := 0;
Could you be more clear.
My variable are :
Name DataType Subtype Length
csc Automation 'CSClb'.Class1
csc.ReadCardDetails ==>> ArrayListNow or Never0 -
Hi, sorry I have seen your replay now.
It's easy:
In my case, I had did to implement an array of byte, becouse I had had the necessity to send a file XML from NAV to NAV by a DLL C# .NET. In C# .NET I will writing this sentence :
byte[] readBuffer = new byte[4096];
to that in NAV you have to define in development environment this type of global variables.
Name DataType Subtype Length
NETArray DotNet System.Array.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
NETTYpe DotNet System.Type.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
NETConvert DotNet System.Convert.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
NETArray : Is a .NET namspace "System", in our case we have necessity of a subsidiary namespace "Array", so you make, in NAV, a
global variable "DotNet" finding "System.Array.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
NETTYpe : Is a .NET namspace "System", in our case we have necessity of a subsidiary namespace "Type"; you have necessity of this variable becouse when you will instance the array you must specify the type of array : byte (in my case), string, ecc
NETConvert : In my case I made a conversation from "Stream" to "String"
Well, now you can create your array, in the manner :
1) Define the type of array, in my case was of byte
NETTYpeLocal := NETTYpeLocal.GetType('System.Byte',FALSE);
2) Instancing the array specifying the type of arrya trought the variable "NETTYpeLocal" and specifying the lenght of array.
NETArrayLocal := NETArrayLocal.CreateInstance(NETTYpeLocal, XMLText.LENGTH);
Now you can use that, I convert my XML text in byte putting them in my array
NETArrayLocal := Encoding.UTF8.GetBytes(XMLText);
bye!! :-)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