How to use IDEA equations in scripts and custom functions

31 posts / 0 new
Last post
Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57
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.

macroKV
Offline
Joined: 01/24/2013 - 10:49

I tried this for the reverse function but it did not work. the Syntax I used is iReverse(Inputstring). Has anybody been successful with ireverse?

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

I just tried this script and it works. If I enter abcde it will retrun edcba. I am at work right now using V8 of IDEA so I haven't tested this to see if it works on V9 but it should.

Sub Main

Dim sString As String

sString = InputBox("Please enter a string")

sString = iReverse(sString)

MsgBox sString


End Sub

 

macroKV
Offline
Joined: 01/24/2013 - 10:49

Your Suggestion works. I'm still using V8.5. Thanks a lot!

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Glad I could help.

gaban
Offline
Joined: 01/08/2014 - 12:50

I am using IDEA v 9.2, I can't use "iSimilarPhrase" function in script. But I can use "iReverse". Look like v 9.2 does not support all new functions to use in script.

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Unfortunately that seems to be true, I just tried it myself and it give a "Sub or function not defined" error.

MartinSaumure's picture
MartinSaumure
Offline
Joined: 06/17/2014 - 13:55

Hi,
This was useful to me, I'm using Idea v8.05 and I simply used the following synthax:
field.Equation = "@strip(column1)"
Needless to say that this makes my scripts very difficult to debug since the equation had to be on one line.
I'll now attempt to change the existing script I have to the "iFunction" synthax, which is a must before I can improve it.
Many thanks!
Marty

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Marty, and welcome to the site.

You wouldn't use the "iFunction syntax" in any formula that would use the equation editor.  The "iFunctions" allow you to access most of the functions that are used in the equation editor directly in calculations that you peform within your scripts.  One I use fairly often is the iReplace as the IDEAScript version of visual basic doesn't have an easy way to perform this function.

So let me know how your update works.

Brian

robgentile
Offline
Joined: 08/05/2014 - 10:29

The "i" for "@" substitution feature in scripts is very useful! However, I just ran into another case (SimpleSplit) that fails, though Split works fine. 
Does anyone happen to have a list of ifunctions that don't work? 

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Rob, my guess would be that when they updated to version 9 they didn't update the functions for ideascript.  SimpleSplit is a new function in V9 so that is probably why it doesn't work whereas Split exists in version 8.  So I don't have a list but I think most functions will work except possibly the new ones that were added in V9.

Pages