How can I convert C/AL decimal type to .NET string type?
undy0602
Member Posts: 67
Hello All,
I have to use .NET assembley in NAV. But I cant put data into .NET string type.
How can I convert C/AL decimal type to .NET string type? also from .NET string into C/AL decimal/text
Regards,
Undy
I have to use .NET assembley in NAV. But I cant put data into .NET string type.
How can I convert C/AL decimal type to .NET string type? also from .NET string into C/AL decimal/text
Regards,
Undy
0
Answers
-
Hi undy,
have you already checked out built-in data type mapping between C/AL and .NET ?
As per
https://msdn.microsoft.com/en-us/library/hh165619(v=nav.90).aspx
C/AL strings can be mapped to .NET strings directly.
So a simple convert of your C/AL decimal into C/AL string by using FORMAT should do the trick...Variables: NAVDecimal Decimal DotNetString DotNet System.String.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' NAVDecimal := 1.2345; DotNetString := FORMAT(NAVDecimal); MESSAGE('%1',DotNetString);
Hope this helps
Andrew T.0 -
Thanks Andrew T.
I`ve already tried that. But it appears dont match types. Is there any reason for this?
Regards,
Undy0 -
Difficult to say without knowing your .NET assembly. I would assume it doesn't provide a simple string datatype but something more complex as a first guess. For instance you won't be able to autoconvert if your .NET datatype has a nullable datatype.
I would suggest to check your .NET datatypes. Have a look at the constructors and methods of the .NET variables displayed on your C/AL Symbols and try to identify its data type.
Andrew T.0 -
Thanks Andrew
I try to integrate to other system using this assembly so I dont know about that well.
I only know fields and data type. Functions return by JSON Ustring data type.
0 -
Ok, sounds like my initial assumption is correct then. The JSON Ustring datatype seems to cause the problem here as it doesn't seem to be based of the simple .NET datatype System.string so you cannot apply the integrated data mapping provided by NAV's .NET interop.
As I do not have any experience with JSON data type integration into NAV I cannot help you any further but initially you would have to find out how to deal with this JSON string datatype in NAV.
Just an idea - can you assign it to a .NET variable of type System.string ?
Cheers
Andrew T.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
- 322 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