Skip to main content

IDEAScripting Tips and Hints

Description

Post for tips and hints on how to use IDEAScript.

How to update an IDEA ".ise" Script

Hello,
I am not a programer, but I use IDEA quite a lot at my work. I have a very useful IDEA script that I use to import multible Excel Files in the same folder, with the same file layout inot IDEA.
the Script has an extension of .ise, which dosn't enable me to open it. I am only able to Run it from the macros menu in IDEA.
 
I like to be abe to open this script in IDEA, so I can understand how it works, and may be make some changes to it, to be able to do more.
 
how can I do that?
 

Seperate number columns into date

I had three number columns that I needed to concatenate as a date field. Here is what I figured out:
Appended a column, virtual date, and the following formula which concatenates and turns the number fields (@str) into a character field THEN "Character to Date":
 
 
@Ctod((@Str(MO,2,0)+@STR(DY,2,0)+@Str(YR,4,0)),"MMDDYYYY")
 
It provided the following date:
"mm/dd/yyyy

Generate Field Statistics

I am writing a scipt to calcualte some ratios and am using the fieldstatistics funciton @FieldStatistics( "column 1 ",6 ). When i run the procedures as a script i am getting an error because field statistics have not been generated on the database prior to the calcualtions. Is there a command that i can use within idescript that will generate fieldstatistics?

Unique Filename for Key Value Extraction

I was creating a script using the Key Value Extraction and I wanted to use a unique filename.  In this test it takes a prefix (task.DbPrefix = "new filename") and will return the final filename.  I tried using the client.uniqueFilename which returns a unique filename but it this instance it doesn't like it because it also gives the path information and the extension so I came up with this work around.  I use the client.UniqueFilename and then remove the path information by using the iSplit function (a function available in the equation editor) and I then remove the extension

Adressing functions dynamically

Hi Brian,
your website has been really succesfull in helping me out with several IDEA issues. Thank you so much. However, I didn't find so far a solution to call functions dynamically (Call functions with the names: Function1, Function2, Function3 ...). Therefore I wanted to ask, whether you know a function (similar to VBA Excel's Eval) for sth like this (see also file):
Dim CurrentFunction as String
For Counter=1 to 5
CurrentFunction= "Function" & Counter
Call Eval(CurrentFunction)

Using the Type Function with Arrays

I found this out by playing around with it but you can use the Type function within an Array.  For a refresher the type allows you to create a data type containing one or more elements.  You then use it as a dot variable, in the example below I have created a type that holds three elements, the last name, first name and middle initial.  I have grouped them all together in a type function called FullName.  To access the type you would define a varialble such as Dim ClientName() as FullName for an array or Dim ClientName as FullName for a single variable.  To set

Defining Variables

In IDEA if you use the option explicit it will force you to define a variable by using the Dim statement.  If you don't define a variable, all the variables are defined as variants.  Also IDEA allows you to place several variables on the same line such as:

Dim myString1, myString2, myString3, myString4 as string

Importance of refreshing your data

When developing a script you are probably running it multiple times at the very least and for a large script it may be in the hundreds of times that you run it and test it.  If the script is making changes to a database, such as creating fields, deleting fields, etc you might want to refresh your database every once in awhile.  I have had several occasions (this morning was one of them) where I was working with a fairly large script, part of the script created a number of virtual fields in one of the database.  So when I ran the script this morning and starting getting strang