Skip to main content

IDEAScripting Tips and Hints

Description

Post for tips and hints on how to use IDEAScript.

I have a syntax error in my script but the line looks fine

I was working on a script that I will hopefully post to the site in the next few days.  Tonight I came back to it and it was giving me a syntax error on line 56.  Looked at the line and it looked fine, tried it again and the same thing.  So I commented out the line and still got the error on line 56.  Changed some code and moved the line and the error was still on 56.  Then I remembered, I had several dialogs and each of those dialogs has hidden code, so line 56 that it was showing me in the IDEAScript editor isn't actually line 56 it is some other line (yes the edi

Using the DlgListBoxArray

The DlgListBoxArray allows you to change the items in a drop list within the dialog.  You have a few alternatives when setting up a drop list, you can include an array in the Attached List properties of the drop down tool or you can use the DlgListBoxArray from within the dialog function.  Tonight I was creating a dialog and because I usually use the DlgListBoxArray I didn't bother to define an array as part of the Attached List properties, when I tried to retreive the item number it kept coming up as blank.  It took me awhile to realize that you need to attach something to t

Errors in dialog

Well I just found something out this morning.  You may or may not know that the IDEAScript editor hides the code for the dialog and instead shows a graphic representation of the dialog, which is great but it does have a few problems.  I had written some code and unfortunately I had named a dialog component in an incorrect format so I was receiving an error.  The problem was that within the editor it was showing the error as being part of the script and not showing the error as part of the dailog.  I finally clued in after realizing that no matter what I did to the script

Rounding Up or Ceiling

IDEA and VB doesn't have a native function to round up or get the ceiling of a number.  What I mean is if you have the number 1.2 and you want to round up, if you use round() or int() you would get 1 instead of 2.  I found this function on the internet at http://www.xtremevbtalk.com/showthread.php?t=118971 that seems to work.  Here is the function that you can place into IDEA.

Test to see if an array is empty

I just posted a snippet that will test to see if an array is empty and return TRUE or FALSE.  If you Dim an array such as DIM myArray() as string you haven't initialized it yet, if you test to see if anything is in it IDEA will raise an error.  The snippets tests for the error and returns a true or false.

Key Value Extraction Array

Well I just learned something tonight.  The IDEAScript for a key value extraction uses an array to hold all the values to extract.  When I was creating the script I assumed that the array was one of string since it was holding text but when I did that the script kept giving me an error when I got to that line.  Turns out that when you define the array you either don't tell IDEA what it is or define it as a Variant so it needs to be one of these:

Use an IDEA field if updating the data directly

In IDEAScript you can update the data directly in the cell by using the RecordSet and Record objects within IDEA.  Usually you would first create the field using the field manipulation functions.  If you create a virtual field and then try to do the update through the Record object the script will give an error.  You have to instead create an idea field, what I mean instead of selecting virtual numeric, virtual character, etc you would select the numeric, character, etc fields and that will allow you to do the update properly.