Skip to main content

IDEAScripting Tips and Hints

Description

Post for tips and hints on how to use IDEAScript.

How to get the date created or modified from a file

I recently gave an intro course in IDEA and one of the participants wanted to know how to obtain the date and time of when a file was created so that they could add it to the file name in a script they were creating.  The functions doesn't exist within the IDEA basic keywords but it does exist within the objects that IDEA has access to, namely the Scripting.FileSystemObject which allows you to access all the information about a file.  So to obtain the date created or last modified you could use something like this:

Need to close IDEA database after using the RecordSet commands

I am in the process of updating my Benford scripts so that all the analysis are in the same script and it is more in line with the look and feel of V9 of IDEA.  In one portion of the script I have to use the IDEAScripting RecordSet commands, these commands allow you to make changes directly to the data in the IDEA database.  In order to use this you must first unprotect the database or column you want to make changes to and then protect them once you are finish or else they are left as editable fields.  The problem I found is that you can make the changes but unless you close

Using Regular Expressions in IDEAScript and Custom Functions

Regular Expressions or regexp is a powerful language that allows you to search for word patterns or replace word patterns with another pattern.  It is so powerful that it can be considered a language onto itself.

Microsoft defines it as "Regular expressions provide tools for developing complex pattern matching and textual search-and-replace algorithms."

This VBA functionality is available in IDEAScript and Custom Functions.  The following is some example code on how to

How to use IDEA equations in scripts and custom functions

IDEA has over 100 functions that can be used in the equation editor.  The program has functions to manipulate character, numeric and time fields to name just a few.  You can also access all these functions in IDEAScript and Custom Functions by putting an i in front of the function.  So in the equation editor you use the @mid() function, if you wish to use it in a script or a custom function put an i in front of it like imid() to access it.

Passing variables to functions and subs

One of the Canadian trainers sent me these two scripts.  They look pretty much alike but the first one references the functions and subs using function x while the second uses function (x) so the only difference is that the variable being passed is in () in one of the script.  Well if you try and run it you get the expect results with the first test in that the varaible gets incremented but if you run the second script the variable keeps the value 1 all along.  Well it turns out that this is the way that microsoft wanted it to work, you can see their rational at