Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dave Pendreigh Audit Specialist, HMRC

Similar presentations


Presentation on theme: "Dave Pendreigh Audit Specialist, HMRC"— Presentation transcript:

1 Dave Pendreigh Audit Specialist, HMRC
IDEA User Group – 1 December 2016 An Appreciation of IDEAScript & BASIC Script (With some live examples) Dave Pendreigh Audit Specialist, HMRC 1

2 IDEAScript v BASIC Script
‘Car’ is an object ‘Colour’ is a property IDEAScript is the “Object Model”. (Objects have “methods” and “properties” which you can use to “do stuff” e.g.: a car property may be “colour=red”, or “make = Ferrari” a car method may be “brake” or “accelerate” BASIC Script is the language itself e.g. Declaring variables Flow of logic (conditionals, iteration) Interaction with other products, e.g. Excel, Outlook etc. (automation) ‘Accelerate’ is a method Objects tend to be nouns Properties tend to be adjectives and methods tend to be verbs. Methods can have arguments which are usually adverbs (e.g. brake fiercely or accelerate carefully) 2

3 Ways to Generate Script (1)
Use the history view Set task = Client.GetImportTask("ImportExcel") dbName = "C:\Users\ \Documents\Audit\****\Data From Business\Product Master File.xlsx“ task.FileToImport = dbNametask. SheetToImport = "Product Master File“ task.OutputFilePrefix = "TestData“ task.FirstRowIsFieldName = "FALSE“ task.EmptyNumericFieldAsZero = "FALSE“ task.PerformTask dbName = task.OutputFilePath("Product Master File") Set task = Nothing Client.OpenDatabase(dbName) 3

4 Ways to Generate Script (2)
Record a macro! Record Macro 4

5 Ways to Generate Script (3)
Write you own (using code from the previous two if you’ve got any sense!) Why write your own? IDEAScript will only work sequentially through each line IDEAScript just uses the object model To reap the benefits of BASIC Script you need to write it yourself, so You can add conditions, iteration (looping), control other programs (automation) You can define custom functions You can generate custom dialog boxes Objects tend to be nouns Properties tend to be adjectives and methods tend to be verbs 5

6 Custom Function Example
VAT Registration No validation Modulus97 and Modulus9755 checks VAT No = 1 * 8 = 8 6 * 7 = 42 8 * 6 = 48 7 * 5 = 35 4 * 4 = 16 3 * 3 = 9 3 * 2 = 6 Sum mod 97 = 67 – 97 = -30 (absolute value = 30) 6

7 Custom Function Example
7

8 Custom Function Code Function Mod97(strVATNo As String) As String
Dim i As Integer Dim intTotal As Integer For i = 1 To 7 intTotal = CInt((Mid(strVATNo, i, 1)) * (9 - i)) + intTotal Next i intTotal = intTotal Mod 97 intTotal = Abs(intTotal - 97) If intTotal = Mid(strVATNo, 8, 2) Then mod97 = "True" Else mod97 = "False" End If End Function 8

9 Macro Example Allows user to specify folder where IDEA databases are located User select which databases they wish to export Script exports each database to a sheet in one Excel workbook 9

10 Automation Allows user to use most of the standard Windows dialogs to collect information Allows access to the Windows file system. Enables control of a lage number of Windows and MS Office functions including opening applications, creating new workbooks, Word docs etc and manipulating them It’s also possible to use the VBA Editor in these Office applications to control IDEA 10

11 Thank you for the invite! Any Questions?
11


Download ppt "Dave Pendreigh Audit Specialist, HMRC"

Similar presentations


Ads by Google