IDEASnippets

Test to see if Array is empty

This function will test to see if an array is empty or not and will return true or false.  I added a line at the beginning of the function to make sure the err.number is 0, I had it happen that it would show an error but the error wasn't caused by the testing but by something else.

The following is an example on how to use it:

Dim myArray() as string

Checking for a list of charcters in a string

I came up with this function while trying to validate a filename for a script.  The function will take a string and a list of characters to look for and will return true if the string contains one or more of those characters.  An example would be looking for \/:*?"<>[]| as these characters should not appear in a filename, so if they exist the filename is not valid.  You would call it in the following way:

checkForSpecialChar(newFilename, "\/:*?""<>[]|")

Using listboxs to select files/fields

A common problem with IDEAScript is there is no easy way to select multiple files or fields.  This script shows you one way of performing this operation.  This is a working example script.  It has a main menu that allows you to open the listbox dialog.  The main menu also allows you to select which type of fields you want to display, when you select ok you will have a message box of the fields that you selected.  You can download the code.

Check if File or Directory Exists

This snippet will check if a file or directory exists.  It returns true or false and you send the full pathname and filename.  I adapted this snippet from one I found at http://www.vbaexpress.com/kb/getarticle.php?kb_id=559

Action Field

This snippet was created by CB and it allows us to use IDEAScript to create an action field.  The function takes three parameters:
The master file, this is the file in which the field will hold the action (i.e. this field will become a link and when click on will extract all the records from the secondary file)

  1. The detail file, this is the file that contains the transactions that will be extracted.
  2. This is the common field between the two (must be the same name) that the action will be linked by.

Get most recent file from a directory

I found this snippet by doing a google search and adapting it to IDEA.  It will return the name of the most recently saved file from a directory.  With a bit of change it should also find the most recently modified file from a directory.

Create a delay

This little snippet will allow you to delay your code by x number of seconds.  Just use the call wait(x) where x is the number of seconds you want the script to pause.

Remove Blanks from an Array

This function will remove any blank elements within an array.

How to sort an array

Somteimes you need to be able to sort an array.  This function will take a single array and sort it in alphabetical order.

Log10

This function will return a Log10 value

Pages