ExcelBuffer

Synphony
Member Posts: 7
I am fairly new to NAV (as a heads up). The two quick questions I have are related to the same project.
Using the ExcelBuffer is there a process to deal with reading a protected Excel file? Something along the lines of "ExcelBufferCover.ReadSheet(password);"
Using the ExcelBuffer what is the easiest way to make NAV's decisions case insensitive, for example "IF.... = 'Yes'" would also include 'yes', 'YES', and so on.
I appreciate any and all information.
2009 R2
Using the ExcelBuffer is there a process to deal with reading a protected Excel file? Something along the lines of "ExcelBufferCover.ReadSheet(password);"
Using the ExcelBuffer what is the easiest way to make NAV's decisions case insensitive, for example "IF.... = 'Yes'" would also include 'yes', 'YES', and so on.
I appreciate any and all information.
2009 R2
0
Comments
-
As you are fairly new it is worth looking inside existing Dynamics NAV code for examples, I hope this will point you in the right direction.
To answer Question 2 have a look at Report: 81 "Import Budget From Excel".
There is a function 'AnalyzeData' where you will see the code you want to compare strings case insensitive by forcing it to Uppercase.UPPERCASE(ExcelBuf."Cell Value as Text")
CASE TRUE OF (STRPOS(UPPERCASE(ExcelBuf."Cell Value as Text"),Text009) <> 0): BEGIN IF HeaderRowNo = 0 THEN BEGIN HeaderRowNo := ExcelBuf."Row No."; TempExcelBuf := ExcelBuf; TempExcelBuf.Comment := Text010; TempExcelBuf.INSERT; END ELSE ERROR(Text011); END;
Text009 = 'G/L ACCOUNT NO'
Text010 = 'G/L Account No.'
The code is looking for a header column that includes the text 'G/L ACCOUNT NO', so "G/L ACCOUNT NO","g/l account no." or "G/L Account No." will return TRUE and Text010 will become the Heading for that Column G/L Account No.
HTH
DavidAnalyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
Thanks for the response.
Come to find out after altering the code to use the uppercase() function the field in excel is a Boolean field (which caused me compile errors and lead to investigation). As of now this is a non-issue, however toying around more with the uppercase() function I will definitely have uses for it in the future.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