Decimal data type and Automation in Role Tailored Client

Nav_Noob
Member Posts: 25
Hello,
I have a .NET DLL which exposes some properties as COM. For example:
public decimal Amount
{
[return: MarshalAs(UnmanagedType.Currency)]
get{ return this.amountField; }
set{ this.amountField = value; }
}
I have a decimal type in NAV which I pass to the Amount property. For example:
"Automation Line".Amount := "Decimal Var";
This works fine in the classic client but when the code runs in the role tailored client, I get the following error:
This message is for C/AL programmers: The call to member Amount failed: Method
'My.Namespace.Line.Amount' not found..
All non-decimal types work fine in the role tailored client. One work-around might be to extend the DLL by adding a method which takes the line amount as a string and have the DLL convert the string to decimal, but I'd rather not extend the DLL if at all possible. Does anyone have any idea what could be going wrong or a better solution?
Thanks,
Adam
I have a .NET DLL which exposes some properties as COM. For example:
public decimal Amount
{
[return: MarshalAs(UnmanagedType.Currency)]
get{ return this.amountField; }
set{ this.amountField = value; }
}
I have a decimal type in NAV which I pass to the Amount property. For example:
"Automation Line".Amount := "Decimal Var";
This works fine in the classic client but when the code runs in the role tailored client, I get the following error:
This message is for C/AL programmers: The call to member Amount failed: Method
'My.Namespace.Line.Amount' not found..
All non-decimal types work fine in the role tailored client. One work-around might be to extend the DLL by adding a method which takes the line amount as a string and have the DLL convert the string to decimal, but I'd rather not extend the DLL if at all possible. Does anyone have any idea what could be going wrong or a better solution?
Thanks,
Adam
0
Comments
-
I think your problem is the ReturnAs() - the RTC runs all your code in Managed code - you should try a couple of different return type options.Freddy Kristiansen
Group Program Manager, Client
Microsoft Dynamics NAV
http://blogs.msdn.com/freddyk
The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.0 -
freddy.dk wrote:I think your problem is the ReturnAs() - the RTC runs all your code in Managed code - you should try a couple of different return type options.
Hi Freddy,
Thanks for your response. I'm not exactly sure what you're saying. Are you saying to try a different return type in my DLL? Maybe I should try marshaling my decimal types as something other than UnmanagedType.Currency? Or are you saying there is something I can do on the NAV side of things? I wasn't quite sure what you meant by ReturnAs(). Thanks again for your input and if you can elaborate a little bit more on the different return type options that you mentioned, it would be a great help.
Thanks,
Adam0 -
Manage it as decimal, not as currency, because it IS decimal and not currency in NAV.0
-
kine wrote:Manage it as decimal, not as currency, because it IS decimal and not currency in NAV.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