Navision changes the

ib000904
Member Posts: 19
I'm trying to create a report from file 32 (Item ledger entries) which, as a sort of hidden feature, creates a subtotal of all the processed 'quantities' in a cell in an existing spreadsheet.
Apart from the usual declaration-commands to activate excel, i added some commands in the onaftergetrecord() section:
X:=xlsheet.Range('B2').Value; // read Cell B2 into variable 'X
X+="Item Ledger Entry".Quantity; // Add quantity-value to 'X'
xlsheet.Range('B2').Value:=X; // write X back into cell B2.
Strange thing is, if i initially fill Cell B2 with '-1,00' with no currency format whatsoever, right after the first record has passed, cell B2 is filled with something like € 98,00- (quantity having been -97).
In the second pass this '€ 98,00-' is obviously suddenly seen as text, because an error message appears about trying to convert text into a decimal-variable.
How do i fix cell B2 to it's initial format without currency?
Apart from the usual declaration-commands to activate excel, i added some commands in the onaftergetrecord() section:
X:=xlsheet.Range('B2').Value; // read Cell B2 into variable 'X
X+="Item Ledger Entry".Quantity; // Add quantity-value to 'X'
xlsheet.Range('B2').Value:=X; // write X back into cell B2.
Strange thing is, if i initially fill Cell B2 with '-1,00' with no currency format whatsoever, right after the first record has passed, cell B2 is filled with something like € 98,00- (quantity having been -97).
In the second pass this '€ 98,00-' is obviously suddenly seen as text, because an error message appears about trying to convert text into a decimal-variable.
How do i fix cell B2 to it's initial format without currency?
0
Comments
-
It looks like you're trying to write your own custom logic using the Office Automation objects. I have 2 suggestions:
1) take a look at Table 370 - Excell Buffer (as it has code in there to handle writing Excel data via the Automation dlls)
2) Don't write any automation code yourself - just use the Excel Buffer table and it's functionality to write to Excel. This will allow you to focus on writing Navision code and let it handle the Excel/Automation logic.0 -
The standard Navision feature with table 370 only allows you to WRITE data to an Excel file. Not to interact with Excel. I want to read something from Excel, compare that to something that's in Navision, do some calculation and then write the result back to Excel. Easy as that.
Can't achieve that using the mentioned Navision-Excel features for that.
To be honest, why not use the full potential of the MS-environment, if the system allows you to?0 -
Don't get me wrong - I'm all for using external COM/Active X objects and components in Navision. I just like to reuse whatever I can before I look to building new things.
Have you tried using the variant datatype? As some controls/automation objects use variants instead of explicit data types it can be easier to use that variable type and then handle any conversion logic youself (i.e. stripout currency symbols).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