CasewareDocs

CreateActionFieldForScript

Creates the action field for an IDEA database which executes an IDEAScript.

Compatibility

Available as of IDEA version 10.0

Syntax

CreateActionFieldForScript(database as Object, fieldName as String, scriptPath as String, paramType1(Int32) param1 as String, paramType2(Int32) param2 as String, paramType3(Int32) param3 as String, paramType4(Int32) param4 as String)

Parameters

database

Specifies the IDEA database. This parameter can be an object of type COMMONIDEACONTROLSLib.IIdeaDatabase, obtained with Client.OpenDatabase), or a string which represents the full path or the relative path to the project for an IDEA database.

fieldName

Specifies the name of the field for which the action field is created.

stringPath

Specifies the full path or the relative path to the project for an IDEA macro which will be executed when the user clicks the specified field. In case the macro is located on a server, a UNC path has to be provided.

For creating a script in a library you can use the method CreateUniqueFileInProjectLibrary.

paramType1 param1

paramType2 param2

paramType3 param3

paramType4 param4

Specifies the parameter types and the parameter values. You can pass four parameters on to macro. The parameters are accessed in the macro using the keywords arg1, arg2, arg3, arg4. Possible values for paramType are:

0, if you want to obtain the RecordNumber of the current row, in this case param has to be empty or null.

1, if you want to pass a user-defined value, in this case param has to be the user-defined value.

2, if you want to obtain the value of a field of the current row, in this case param has to be the name of the field.

Example

Option Explicit

Dim databaseName As String
databaseName = "Employees.imd"
Dim scriptPath As String
Dim script As String
script = "Sub Main" + Chr(13) + Chr(10) + "End Sub"
scriptPath = SmartContext.MacroCommands.SimpleCommands.CreateUniqueFileInProjectLibrary (2, + TestMacro.iss , script, 0)
Dim database As Object

Set database = Client.OpenDatabase(databaseName)
SmartContext.MacroCommands.SimpleCommands.CreateActionFieldForScript database, "EMPLOYEEID", scriptPath,0, "",1, "User Defined Value1",2, "EMPLOYEEID",1, "User Defined Value2"

Set database = Nothing

End Sub