Some of the objects that you find in scripts

main
The main object is the top-level thread. It is of class RSInterface and has methods for manipulating assembly lines (see the JavaDocs).
system
The system object contains lots of handy methods for scripting. It is of class UserFunctions (see the JavaDocs).
task
The task object is of class TaskInterface. It represents the current thread of execution: either an AssemblyLine thread or an EventHandler thread.

Entry objects

work
The data container object of the AssemblyLine. It is accessible in every connector.
conn
The local storage object in connectors. It only exists during the Attribute Mapping phase of the connector's life. See "Attribute Mapping" in the Ref Guide.
event
The event object is the work Entry object when scripting inside EventHandlers, just like the conn object during Attribute Mapping.
current
Available only in Connectors in Update and Delete mode. Stores the Entry that the Connector read from the data source to determine whether this is an Add or Modify operation.

Finding objects in the JavaDocs

Details about these objects are detailed in the TDI JavaDocs under the class names shown above. But what about other objects like Connectors and TCBs. It's not always obvious what the class name is.

Java itself gives you a quick way to find out. The base object, called Object, from which all others inherit offers the getClass() function. The return from this method converts nicely to a String, allowing the following:

task.logmsg(" system is " + system.getClass());
task.logmsg("   task is " + task.getClass());
task.logmsg("   main is " + main.getClass());
task.logmsg("myAL_FC is " + myAL_FC.getClass());

Of course, the above example assumes that there is a component called "myAL_FC" in the AssemblyLine.

The easiest way to run or test a script is by putting it in a Prolog Hook of an empty AssemblyLine or in an empty Script in the AL Flow section. Then when you run the AL, all you do is execute the script.

Another quick method is to run the AssemblyLine in the Debugger. This powerful tool provides a JavaScript command line where you can enter script snippets directly with result appearing immediately in the log output window each time you press the ENTER key.

AndrewFindlay - 25 Feb 2011

-- EddieHartman - 25 Feb 2011
Topic revision: r5 - 25 Feb 2011, EddieHartman - This page was cached on 09 Aug 2024 - 17:02.

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TDI Users? Send feedback