Skip to main content

"Looping" IDEA Script Example

Hi Brian,
I have developed a script in ACL that uses a command called the GROUP command.  The GROUP command allows you to process a single record mulitple times and in effect, lets you set up a "loop" that allows you to do different types of data analysis tasks.
Is there a similar command in IDEA or is there a way I can accomplish this same thing using the IDEA scripting language? If you have an example IDEA script that you can point me to, that would be great.
Thanks so much in advance for your help!
Mike

Brian Element Tue, 12/29/2015 - 17:33

Hi Mike,

Yes, you can do looping through script such as doing a for next or a do while loop.  Can you give me a better idea of what you are trying to do and I can probably help you out.

Brian

mkeiffer33 Wed, 12/30/2015 - 15:42

Hi Brian,
The test that I am doing is where you go through a data file and you replace common shortened names like Jim with James or Mike with Michael.  My script in ACL will process each record multiple times, looking for several names such as Mike and Jim, then it will replace the shorter names with the longer names.
Let me know if that helps and thanks so much for your assistance!
Mike

Brian Element Wed, 12/30/2015 - 19:05

You don't necessarily need a script to do this but you can create a virtual field with the following formula:

@CompIf(@Isini("Mike", FIELD), @Replace(FIELD, "Mike", "Michael"), @Isini("Jim", FIELD), @Replace(FIELD, "Jim", "James"), 1, FIELD)

Not sure how many you have to replace, if it is not that many you can use the @CompIf function.  If you have too many let me know and I will see what I can come up with in a script.

Brian