Programmers Guide
Programmers Guide
Programmer's Guide
Document #: 8.1.12042006
Last Modified: 4/4/2007
Copyright 2007
Aras Corporation
ARAS CORPORATION
Notice of Liability
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 2
Table of Contents
SEND US YOUR COMMENTS ...........................................................................................7
1
INTRODUCTION..........................................................................................................8
1.1
1.2
1.3
AML ..............................................................................................................................10
2.1
<ITEM> TAG ...........................................................................................................10
2.2
<RELATIONSHIPS> TAG ..........................................................................................10
2.3
<PROPERTY> TAGS ..................................................................................................10
2.4
ATTRIBUTES............................................................................................................11
2.4.1
Item Attributes................................................................................................11
2.4.2
Property Attributes.........................................................................................12
METHODS ...................................................................................................................19
4.1
ITEM ACTIONS EXTEND THE ITEM CLASS ...............................................................19
4.1.1
Context Item ...................................................................................................19
4.1.2
Methods are Item Factories ...........................................................................20
4.1.3
Handling the Wrong ItemType.......................................................................20
4.1.4
Methodology ..................................................................................................21
4.2
BUILT IN ACTION METHODS ...................................................................................21
4.3
GENERIC METHODS ................................................................................................22
4.3.1
Context Item ...................................................................................................22
4.3.2
Methods are Item Factories ...........................................................................22
4.3.3
Methodology ..................................................................................................23
4.4
SERVER EVENTS .....................................................................................................23
4.4.1
Context Item ...................................................................................................23
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 3
4.4.2
Methodology ..................................................................................................23
4.4.3
Available Server Events .................................................................................24
4.5
CLIENT EVENTS ......................................................................................................27
4.5.1
Context Item ...................................................................................................27
4.5.2
Form Events ...................................................................................................27
4.5.3
Field Events ...................................................................................................28
4.5.4
Grid Events ....................................................................................................29
4.5.5
Item Actions and Server Event.......................................................................32
5
ACTION ITEMS..........................................................................................................33
5.1
CLIENT SIDE METHOD RULES .................................................................................33
5.2
SERVER SIDE METHOD RULES ................................................................................34
5.3
USE CASES ..............................................................................................................35
5.3.1
Client side - has cache Item is dirty...............................................................35
5.3.2
Client side - no cache Item - no item_query value.........................................35
5.3.3
Client side - has cache Item not dirty - no item_query value ........................35
5.3.4
Client side - has cache Item not dirty - has item_query value.......................36
5.3.5
Client side - no cache Item - has item_query value .......................................36
5.3.6
Server side - has cache Item is dirty ..............................................................36
5.3.7
Server side - no cache Item - no item_query value........................................37
5.3.8
Server side - has cache Item not dirty - no item_query value........................37
5.3.9
Server side - has cache Item not dirty - has item_query value ......................38
5.3.10 Server side - no cache Item - has item_query value ......................................38
COOKBOOK ...............................................................................................................40
7.1
7.2
7.3
7.4
7.5
7.6
7.7
7.8
7.9
7.10
7.11
7.12
7.13
7.14
7.15
7.16
7.17
7.18
7.19
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 4
7.20
7.21
7.22
7.23
7.24
7.25
7.26
7.27
7.28
7.29
7.30
7.31
8
.NET CONTROLS.......................................................................................................72
8.1
GRID/TREEGRID/EXCELGRID CONTROL .................................................................73
8.1.1
Initialization from XML .................................................................................73
8.1.2
Grid Methods and Events...............................................................................73
8.1.3
TreeGrid Methods and Events .......................................................................73
8.1.4
ExcelGrid Methods ........................................................................................73
8.1.5
Cell Methods ..................................................................................................73
8.1.6
ContextMenu Methods ...................................................................................74
8.2
MENU BAR ..............................................................................................................74
8.2.1
Initialization from XML .................................................................................74
8.2.2
MainMenu Methods and Events.....................................................................74
8.2.3
Menu Element Methods..................................................................................74
8.3
WORKFLOW ............................................................................................................75
8.3.1
Initialization from XML .................................................................................75
8.3.2
Workflow Methods and Events.......................................................................75
8.3.3
Workflow Item Methods .................................................................................75
8.4
TOOLBAR ................................................................................................................75
8.4.1
Initialization from XML .................................................................................75
8.4.2
Toolbar Methods and Events .........................................................................75
8.4.3
Active Toolbar Methods.................................................................................75
8.4.4
Toolbar Item Methods....................................................................................76
8.5
STRUCTURE.............................................................................................................76
8.5.1
Structure Container Methods and Events ......................................................76
8.5.2
Structure Item Methods..................................................................................76
8.6
GANTT ....................................................................................................................76
8.6.1
Initialization from XML .................................................................................76
8.6.2
ProjectTree Methods......................................................................................77
8.6.3
Task Methods .................................................................................................77
8.6.4
Dependency Methods .....................................................................................77
8.7
STATUS BAR ...........................................................................................................77
8.7.1
Initialization from XML .................................................................................77
8.7.2
Status Bar Methods ........................................................................................77
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 5
8.8
UTILITY CONTROL ..................................................................................................77
8.8.1
Utility Methods...............................................................................................77
8.8.2
Balloon Methods ............................................................................................77
8.8.3
Splash Screen Methods and Events................................................................78
8.9
OTHER CONTROLS ..................................................................................................78
8.9.1
Tabbar Methods and Events ..........................................................................78
8.9.2
Calendar Methods and Events .......................................................................78
8.9.3
Vault Methods and Events .............................................................................78
8.9.4
Color Dialog Method.....................................................................................78
9
10
FEATURES ...............................................................................................................79
DEBUGGING...........................................................................................................80
10.1
10.2
10.3
11
11.1
11.2
11.3
12
13
AML SCHEMA........................................................................................................89
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 6
Do you need more information? If so, where and what level of detail?
If you find any errors or have any other suggestions for improvement, please
indicate the document title, and the chapter, section, and page number (if available).
You can send comments to us in the following ways:
o
Email:
[email protected]
Subject: Aras Innovator Documentation
Postal service:
Aras Corporation
Heritage Place
439 South Union Street
Lawrence, MA 01843
Attention: Aras Innovator Documentation
FAX:
978-794-9826
Attn: Aras Innovator Documentation
Or,
Or,
If you would like a reply, please provide your name, email address, address, and
telephone number.
If you have usage issues with the software, please visit
http://www.aras.com/support/
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 7
1 Introduction
The purpose of this document is to provide a Guide to Programming Aras Innovator.
It covers key aspects of programming Aras Innovator for implementing your own
business logic within the Aras Innovator Enterprise Application Framework.
This document is indented to be used as a Desktop Reference and User Guide
covering the following topics:
1.1
The AML (Aras Markup Language), which is the language that drives the Aras
Innovator server.
The IOM (Innovator Object Model), which is the Object API for the AML.
Explains how Methods work and the Methodology for implement your own
business logic.
A Cookbook of recipes for performing common tasks.
The Item
For example, an ItemType Item has Property relationships and this Item
configuration maps directly to the relational database for persistent storage of the
Item instances. Every ItemType has a matching relational TABLE where the Property
names are the COLUMN names.
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 8
1.2
The AML
The AML (Aras Markup Language) is an XML dialect that follows the simple
/Item/Relationships/Item/Relationships repeating pattern to describe Item
configurations. Clients submit AML documents to the Aras Innovator server and
receive an AML document back.
1.3
The IOM (Innovator Object Model or Item Object Model) is an Object Model on top of
the AML. It provides the ability to build and submit AML documents to the Aras
Innovator Server using a simple Object API.
There is the "Method" ItemType, which are used to implement user defined business
logic. Methods are written in JavaScript, C#, J#, or VB.Net and use the IOM API to
implement the business logic. Three of these four programming languages
JavaScript, C#, and VB.Net are supported by MS .NET 1.1/2.0 Framework by default,
but if you want to program Innovator using J# make sure that Microsoft Visual J#
Redistributable Package is installed on your Innovator server.
The following is a Method in JavaScript using the IOM that is the same as the AML
BOM example above:
var innovator = new Innovator();
var partItem = innovator.newItem("Part","add");
partItem.setProperty("item_number", "999-888");
partItem.setProperty("description", "Some Assy");
var bomItem = innovator.newItem("Part BOM","add");
bomItem.setProperty("quantity", "10");
var relatedItem = new Item("Part","add");
relatedItem.setProperty("item_number", "123-456");
relatedItem.setProperty("description", "1/4w 10% 10K Resistor");
bomItem.setRelatedItem(relatedItem);
partItem.addRelationship(bomItem) ;
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 9
2 AML
The AML is the XML dialect and language that drives the Aras Innovator server.
Clients submit AML documents to the Aras Innovator server via HTTP. The server
parses the AML applying the business logic defined as the action attribute for the
Items in the AML document, and an AML document is returned. The AML dialect is
very simple and the following tags define the AML language:
2.1
<Item> Tag
The <Item> tag defines an Item instance. XML is case sensitive (notice the capitalized
Item.) There are three principle attributes for the Item tag to define the Item
instance:
action which is the name of the Method that is applied to the Item.
There are other attributes but these are the most significant, which defines the Item
and the action to apply on it. The following is an AML query example requesting a
Part Item by ID:
<Item type="Part" id="ACBDEF0123456789" action="get"/>
2.2
<Relationships> Tag
Items can have relationships to other Items. The <Relationships> tag is a container
tag that holds the set of relationship Items. Again notice the capitalized
Relationships. There are no attributes for the tag it is just a container. With
relationships it is possible to describe an Item configuration to any level deep as
necessary.
The following is an AML query example requesting a Part Item and its BOM
relationships:
<Item type="Part" id="ACBDEF0123456789" action="get">
<Relationships>
<Item type="BOM" action="get"/>
</Relationships>
</Item>
2.3
<property> Tags
Properties for the Item are the nested tags directly below the <Item> tag. The
Property name is the tag name. For example, a "Part" ItemType may have the
properties: part_number, part_description, and part_cost, which are also the tag
names in the AML. Property names are lowercase so the property tag names are
also lowercase.
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 10
The following AML illustrates a simple Item configuration for describing a Part to Part
BOM relationship:
<Item type="Part" action="add">
<item_number>999-888</item_number>
<description>Some Assy</description>
<Relationships>
<Item type="Part BOM" action="add">
<quantity>10</quantity>
<related_id>
<Item type="Part" action="add">
<item_number>123-456</item_number>
<description>1/4w 10% 10K Resistor</description>
</Item>
</related_id>
</Item>
</Relationships>
</Item>
2.4
Attributes
Properties are used to define the data for an Item; attributes are meta-data for the
Item or Property, which are used to control the server logic and Methods. Think of
attributes like command line switches, or as arguments to a function.
In addition to the type, id, and action attributes mentioned above there are several
additional attributes used to control the server. The following is the attribute
reference for the <Item> tag:
2.4.1 Item Attributes
Attribute
type
Type
String
where
String
id
Usage
String
action
String
doGetItem
Boolean
The name of the Method (or Built in Action Method) to apply to the
Item.
String
orderBy
String
page
Integer
maxRecords
Integer
pagesize
levels
Copyright 2007
Aras Corporation.
All Rights Reserved.
Used instead of the id attribute to specify the WHERE clause for the
search criteria. Include the table name with the column name using the
dot notation: where="user.first_name like 'Tom%'"
If 0 then do not perform a final get action on the Item after the server
performed that action as defined by the action attribute. Default is 1.
A comma delimited list of property names (column names) to return
which is the SELECT clause in the SQL statement.
A comma delimited list of property names (column names) to order the
results and is the ORDER BY clause in the SQL statement.
The page number for the results set.
Integer
Integer
Page 11
serverEvents
Boolean
related_expand
Boolean
isCriteria
Boolean
If 0 then include the nested structure for the Item configuration in the
response but don't use it as search criteria. Default is 1, which will use
the nested structure in the request as search criteria.
Boolean
Usage
The ItemType name for which the item is an instance of.
keyed_name
This is the keyed_name Property for the Item referenced by the Item type Property.
condition
This is the condition value for the AML query. The condition value is any valid SELECT
condition supported by the database. This is the list of possible condition values:
eq
Condition
ne
gt
Comments
The SQL conditional symbols:
=, <=, >=, <>, >, and <
are expressed as two letter mnemonic word:
eq, le, ge, ne, gt, and le
le
Example
ge
<name condition="gt">100</name>
le
like
not like
between
not between
in
not in
is
is null
is not null
Copyright 2007
Aras Corporation.
All Rights Reserved.
The value for the Property tag would include wild card symbols,
which are % for any characters and _ for a single character.
Example
<name condition="like">Tom%</name>
This is a range condition and you would include the AND
keyword in the Property tag value.
Example
<cost condition="is">null</cost>
<cost condition="is">not null</cost>
<cost condition="is null"/>
Page 12
3 IOM Reference
IOM Reference provides a general description of the IOM (Innovator Object Model or
Item Object Model) API. A more detailed API reference may be obtained from one of
the following:
- On-line: Go to
http://support.aras.com/documentation/documentation.aspx?version=8.1.1.
Under the section Tools, Utilities and Programmers Guides select On-Line
API Guide
- From Innovator Client UI: Login as Innovator Administrator. Under the Help
menu select API Reference
- In Innovator CD Image. Go to the documentation folder and open Aras
Innovator - API Guide.html
The IOM is an Object Model for the AML, but it is not purely Object Oriented. Using
Object Oriented terms, an ItemType is like a "Class" and the Item is like an "Object".
Although the Item is an Object with methods, there is only one Item Class for all
ItemTypes. In a pure Object Oriented representation, there would be a Class for
each ItemType because each ItemType has its own set of Properties to describe the
different Items.
An Item Object is intended to be abstract and pliable; it can represent any Item, for
any ItemType. The Item Object can be a single Item instance, or can be a set of
Items (as in the case for results from a query), or an Error.
The IOM is intended to be a generic and compact API for modeling the Item structure
for the AML as abstract Objects. The majority of the methods for the IOM deal with
memory management of the AML document for the Item. The AML is a script sent as
a message to the Aras Innovator Server; the IOM is an Object API to build the AML
messages and submit them via the Item.apply() method.
Please note, the term method has two meanings in this guide, the typographical
convention used throughout this Guide is as follows:
3.1
IOMCredentials Class
The IOMCredentials Class defines the login credentials for connecting to the Aras
Innovator Server. The Item Class has a credentials public property, which is an
IOMCredentials Object.
Typically, you do not need to know about or deal with the credentials Object because
the Methods run in logged in session. You can, however, set the credentials for the
Item Object using these methods, if you want to submit the apply requests to a
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 13
different Aras Innovator server. The IOMCredentials Class methods are mostly
getters and setters for URLs (Innovator and Vault servers), DB name, and login
name and password.
3.2
Innovator Class
3.3
Item Class
Item public constructor has one required argument itemtype-name and one optional
argument action. The new Item will only be populated with the Properties and
default values from the ItemType when the optional action argument is "add".
The Item Class public field dom represents a DOM Object that holds the data for the
Item in the AML format.
3.3.1 Base Methods
The Item Class base method apply()submit the AML apply request to Innovator
Server using the context Item DOM as AML source and returns a new Item built on
the XML returned by the Server. In contrast, the base method loadAML() does not
return a new Item but rather rebuilds this.dom using AML taken as an argument.
You can call clone()method to get a new identical instance of the context Item and
you can call setNewID() method to replace the context Item id by newly generated
GUID.
3.3.2 Boolean Methods
Call method isCollection()to find out whether or not the Item represents a set of
Items, e. g. whether or not its dom property holds more then one Item node. Call
isError()method to find out whether or not the Item represents an Error. See IOM
API on-line reference for more boolean members of the Item Class.
3.3.3 Attribute Methods
Methods like getAction(), getID(), and getType() return a value of Item node
action, id, and type attribute respectively, while method getAttribute() takes an
attribute-name as an argument and, therefore, can be used to get any attribute by
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 14
Property methods comprise set of accessors to Item properties and Item propertys
attributes: get_, set_ (which acts also as add_), and remove_. In addition, if
property has/need a nested Item there are methods to get/insert such nested Item.
Accessors to Properties are getProperty(), setProperty(), and
removeProperty().These methods take property-name as an argument.
Accessors to Propertys attribute are getPropertyAttribute(),
setPropertyAttribute(), and removePropertyAttribute().
take property and attribute names as arguments.
These methods
If the Item method getType() returns File then two methods getFileName() and
setFileName() can be used as accessors to the file name of the attached file. For
an item of type other then File these methods throw an exception.
3.3.6 Relationship Methods
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 15
As you can see addRelationship() produces in this case more detailed Item node
under the Relationship parent node.
There are three methods getRelatedItem(), setRelatedItem(), and
createRelatedItem() that are valid for relationship Item only and are used as a
short cut to the Item.get/setPropertyItem() methods.
3.3.7 Item Collection Methods
This group comprises methods to work with collections. Collection in this context is a
set of Items as in the case for results from a query. Method appendItem() appends
its Item Object argument to an existing collection or converts a single Item instance
to set of Items. This mechanism is illustrated in a C# sample below:
Innovator myInnovator = this.newInnovator();
Item myItem = myInnovator.newItem("myType","myAction");
At this point, myItem presents a single Item instance, myItem.dom XML looks like
this:
<Item isNew="1" isTemp="1" type="myType" action="myAction" />
If the Item object id is not NULL it can be removed from the collection:
myItem.removeItem(addedItem);
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 16
The methods newOR(), newAND(), and newNOT() insert logical node with tag <or>,
<and> and <not> respectively under the parent Item node and return an Item
Object that represent a newly inserted logical node. For example, the code below :
Innovator myInnovator = this.newInnovator();
Item myItem = myInnovator.newItem("myType","myAction");
Item logicalOR = myItem.newOR();
logicalOR.setProperty("foo", "bar");
In this group there are two methods newItem() and newInnovator() that return
new Item and new Innovator Object respectively. See code samples in sections
3.3.6-:-3.3.8 for these methods usage illustration.
3.3.10 Error Methods
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 17
<Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Body>
<Fault>
<faultcode>any number</faultcode>
<faultstring>Hello, World</faultstring>
<faultactor>myMethod</faultactor>
<detail>new detail</detail>
</Fault>
</Body>
</Envelope>
This set of methods implements specific functionality on the Item, which extends the
base Item Class. For purpose of reference all the Extended Item Class methods are
organized in four categories
Permission method:
getPermission()
Lock methods:
lockItem()
unlockItem()
Life Cycle method:
promote()
Workflow methods:
instantiateWorkflow()
startWorkflow()
cancelWorkflow()
closeWorkflow()
The detailed characteristic and usage illustration of methods above is left outside the
scope of the document. See on-line API reference for more details.
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 18
4 Methods
Business logic in Aras Innovator is implemented using Method Items and are written
in JavaScript, C#, J#, or VB.Net often using the IOM to interact with Aras Innovator
Items.
There are three ways to implement Methods in Aras Innovator on the server side:
Item Action Methods which extend the Item Class and perform logic on Item
instances.
Generic Methods, which implement arbitrary logic.
Server Events which implement logic on the context Item before and\or after
the server operates on the Item.
Similarly there are three ways to implement Methods in Aras Innovator on the client
side:
Item Methods which extend the Item Class and perform logic on Item
instances.
Generic Methods, which implement arbitrary logic.
Form, Field, and Grid Events which implement logic on client side UI events.
The Method Item has a comment Property that you can use to annotate the Method
and can be seen when you search and review the Methods as mentioned above.
4.1
One purpose for Methods is to extend the Item Class. Methods extend the Item
Class when they are bound as the related Item for "Item Action" relationships on the
ItemType. In the AML the Method name is the action attribute name for the Item
tag.
<Item type="My ItemType" action="My Method" id=""/>
The Method could be called using the IOM like this (all three examples below are
equivalent and are written in C#):
1) Item myItem = this.newItem("My ItemType", "My Method");
myItem.setID(this.getID());
Item results = myItem.apply();
2) Item myItem = this.newItem("My ItemType");
myItem.setID(this.getID());
Item results = myItem.apply("My Method");
3) Item myItem = this.newItem();
myItem.setID(this.getID());
myItem.setType("My ItemType");
myItem.setAction("My Method");
Item results = myItem.apply();
As it was mentioned above Item Action Methods are executed on an instance of Item
which is called context item (please read section 5 for more details on how context
item is obtained for Item Action Methods). The context item must be referenced
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 19
inside Item Action Methods as the this keyword in JavaScript, C#, and J#, and the Me
keyword Object in VB.Net. The context item is an instance of IOM Item class;
correspondingly any methods of IOM Item class (see section 3.3 for more details)
could be called on the context item, e.g this.getProperty(foo) (C#) or
Me.getProperty(foo) (VB.Net).
NOTE: In order to be able to execute Methods code Innovator plugs
it into a particular template that provides required code attributes
(method and class boundaries, import statements, etc.). Each
supported language (JavaScript, C#, VB.NET, etc.) have several
available templates in Innovator. All written in the section is
applied to default templates (there is one default template per
supported language). Methods can explicitly redefine the template
that is used during the method compilation. Usage of alternative
templates and methodology of writing valid Methods for them is left
outside the scope of the document.
4.1.2 Methods are Item Factories
Methods follow the Factory design pattern in that they return an Item or Error
Object. The "Item Action" Method must return an Item, which often is the result of
an Item.apply() method call; typically the last step in the business logic for the
Method. There are several ways to create an Item; the following IOM methods
return an Item Object: Item.apply(), Item.newItem(), Item.clone(),
Innovator.newItem(), Innovator.newResult(), and Innovator.newError().
C#
Sometimes it is desirable to share the same Method for many ItemTypes. However,
there are cases in which the Method is intended to be used only by an Item of a
specific ItemType.
The way you can prevent the use of a Method with a context item of a wrong type is
to throw an exception when the wrong ItemType is used (this is what the core Item
Class methods do when the ItemType is not of the specific desired value). Here is a
sample of what should be done in a Method that needs to operate on a specific type
of Item:
JScript, C#, or J#
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 20
4.1.4 Methodology
4.2
The Method name is passed as the action attribute for the <Item> tag in AML.
<Item type="My ItemType" action="My Method" id=""/>
But in addition to Method names as the action attribute value there is also a set of
"Built in Action Methods". These are basically the same as Methods but you will not
find them in the database when searching the Method Items. Nevertheless, they are
called the same way as ordinary Methods via the action attribute.
This is a reference for Built in Action Methods.
Built in
Action
Method
Comments
add
update
If the Item is versionable and is being updated the first time since being locked
the update versions the Item applying the update to the new version, unless the
version="0" attribute is specified, which disables the versioning.
Delete the version of the Item.
purge
delete
get
getItemConfig
Delete all versions of the Item. The purge and delete are the same for non-versionable
Items.
Gets the Item(s) and its configuration based on the AML Item configuration used to query
the database.
This will return the Item configuration as described by the standard AML query. The AML
in and out are no different than the standard action="get".
The GetItemConfig is optimized by limiting the logic done between the SQL call and the
AML result. The performance improvement is gained by limiting the features typically
available in Innovator GetItem (no server events or access checking on the sub level
Items).
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 21
edit
create
This will act as a "get" if the Item exists, otherwise acts as an "add".
merge
This will act as an "edit" if the Item exists, otherwise acts as an "add".
lock
This will lock the Item and is the same as the Item.lockItem() method.
unlock
This will lock the Item and is the same as the Item.unlockItem() method.
4.3
Generic Methods
Generic Methods are used to perform arbitrary business logic. They can be used to
perform any logic you require and its input Item is up to you. They are called in the
IOM with the Innovator.applyMethod() method.
4.3.1 Context Item
The context Item is the this keyword Object in JavaScript, C#, and J#, and is the Me
Object in VB.Net. The XML data for the context Item is the XML submitted as the
payload for the request and it may not be valid AML just well formatted XML. It does
not matter it is the input for the Generic Method and can be whatever you want it to
be.
4.3.2 Methods are Item Factories
The Generic Method must return an Item or an Error just like "Item Action" Methods.
Often the result of the Generic Method is just some simply text or an HTML
fragment. The text can be returned using the Innovator.newResult(text) method
and if the Method needs to return an Error then use Innovator.newError(text)
method.
C#
C# Example
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 22
4.3.3 Methodology
Typically all you need are simply name/value pairs as input for your Method and
those are just like Property tags for the Item. The body for the Generic Method is
nested inside an <Item> tag so you can pass name/value pair as arguments to the
Generic Methods just like ordinary Property tags.
The Item passed as the context Item can represent any Item you want including
fictitious Items, plus you have the added advantage of continuing using the IOM API
to operate on the context Item Object.
4.4
Server Events
Purpose of Server Event Methods is to either perform some custom actions either
before (OnBeforeXXX) or after (OnAfterXXX) a particular server action (like add,
delete, etc.) or fully replace the action processing on server (OnXXX). Detailed
information about available in Innovator server events could be found in section
4.4.3.
4.4.1 Context Item
In case of Server Event Method (see more on Server Event Methods in 4.5) the
context item is a direct analogy of a class instance (i.e. object) in OO programming
in a sense that the Method operates on its context item (as it was menthioned above
the context item could be referenced as the this keyword in JavaScript, C#, and J#,
and the Me keyword Object in VB.Net from inside the Method). In other words the
purpose of a Server Event could be defined as changing the context item, so
modified context item is the result of work done by Server Event Method. Of course,
Server Event Method doesnt necessarily have to alter its context item but rather
perform some other actions (e.g. log some info; send e-mail; etc.); this is usually
typical for Methods performed on OnAfterXXX event.
4.4.2 Methodology
A Server Event Method might return an Item only if it wants to return an error.
Otherwise Server Event Method may not have a return statement.
C#
In the case Method is called as the OnBeforeXXX event and it returns an error, the
context Item is replaced with an Error Item and is simply passed on through to the
client and no further server action is taken. In the case of an OnAfterXXX event the
server rolls back the transaction and passes the Error back on through to the client.
Its important to understand that Server Event Methods that are called on
OnBeforeXXX events operate on request AML sent from client; Server Event Methods
that are called on OnAfterXXX events operate on response AML that server is about
to send back to client and Server Event Methods that fully replace server actions
(OnXXX) get client request AML as context item and must replace it with response
AML that will be passed on through to the client. In other words, its important to
remember that Server Event Methods called on OnBeforeXXX events are invoked
before server parses the request and after the Method is done the context item must
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 23
have a valid request AML format (it could be modified by the method but it still
should have a valid format so that server would be able to parse it). From other
side, Server Event Methods called on OnAfterXXX events are invoked after server
processed the request, and after the Method is done the context item must have a
valid response AML format (it could be modified, e.g. Method could populate it with
federated data, but it should be valid response AML, so that client would be able to
parse it.)
4.4.3 Available Server Events
The following Server Events are currently available in Innovator. Each event below
is followed by a short description and an example of common use.
OnBeforeAdd
o
o
o
OnAdd
o
OnAfterUpdate
o
Copyright 2007
Aras Corporation.
All Rights Reserved.
Runs after an item is added to the database (through the add, create
or merge actions), but before it is returned to the client.
OnBeforeUpdate
o
OnAfterAdd
o
Runs before an item is added to the database (through the add, create
or merge actions.)
Page 24
OnUpdate
o
OnGet
o
Copyright 2007
Aras Corporation.
All Rights Reserved.
OnAfterGet
o
OnBeforeGet
o
OnDelete
o
OnAfterDelete
o
Runs in place of the built-in update action (via update, edit or merge).
Neither OnBeforeUpdate nor OnAfterUpdate events are called when
using OnUpdate.
OnBeforeDelete
o
Runs after a search is executed, but before the results are returned.
Page 25
OnBeforeCopy
o
o
OnBeforeMethod
o
Copyright 2007
Aras Corporation.
All Rights Reserved.
OnAfterVersion
o
OnBeforeVersion
o
OnAfterUnlock
o
OnBeforeUnlock
o
OnAfterLock
o
OnBeforeLock
o
OnAfterCopy
o
Page 26
OnAfterMethod
o
OnGetKeyedName
o
o
4.5
Client Events
There are several Events available on the client side, which include:
Form Events
Field Events
Grid Events
Item Actions
The this keyword context Object is an Item Object for Item Actions. However, the
context Object is not the Item Object for Form, Field, and Grid Events. The this
context Object is the browser document (DOM) Object for the Form and Grid Events
and is the Field Object for Field Events.
The context Item Object for Form, Grid, and Field Events is the document.thisItem
Object, which is an Item Object and should be used with the IOM API. For
relationship grid events use parent.thisItem, which is a pointer to the
document.thisItem Object.
4.5.2 Form Events
The Form Events are the HTML page events; for example, onLoad, onUnload,
onResize, onMouseDown, onMouseUp, and others (please, refer to the "Form Events"
List in Aras Innovator for the complete list of available events.)
You bind your Method to the Form Event using the Form Tool. Select the Form Event
tab and add the event relationships as shown below:
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 27
The Field Events are the HTML field events; for example, onSelect, onClick,
onChange, onBlur, onFocus, and others (please refer to the "Field Events" List in
Aras Innovator for the complete list of available events.)
You bind your Method to the Field Event using the Form Tool. Select the Field by
clicking on it in the canvas area in form Tool or from the Fields grid in the upper left
hand corner of the Form Tool. Select the Field Event tab and add the event
relationships as shown below:
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 28
Grid Events are the events for the grid control, which is used in the Relationships tab
area for tear off Item windows. The grid events occur on the row (section 4.5.4.1)
and on the cell (section 4.5.4.2.)
Like Server Events you bind a Method as the callback for the event as the Grid Event
relationship on the RelationshipType Item, and as the Grid Event relationship on the
Property Item.
The Method gets at least three arguments: relationshipID, relatedID, gridApplet.
The relationshipID is the ID for the relationship Item for the selected row. The
relatedID is the ID for the related Item for the selected row. And the gridApplet is a
handle to the grid control object. The relatedID maybe empty if there is no related
Item for the relationship row. The relationshipID is also the ID for the grid control
row. Edit the RelationshipType Item and add Grid Events relationships as shown
below:
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 29
Comment
The Method for the event will be called with three arguments:
Argument
relationshipID
Type
String
relatedID
String
gridApplet
GridControl
Copyright 2007
Aras Corporation.
All Rights Reserved.
Comment
The ID for the relationship Item. This is also the selected row
ID for the grid control.
The ID for the related Item. The relatedID maybe empty if
there is no related Item for the relationship row.
The handle to the grid control.
Page 30
Comment
The Method for the event will be called with five arguments:
Argument
relationshipID
Type
String
relatedID
String
gridApplet
propertyName
colNumber
GridControl
String
Integer
Copyright 2007
Aras Corporation.
All Rights Reserved.
Comment
The ID for the relationship Item. This is also the selected row
ID for the grid control.
The ID for the related Item. The relatedID maybe empty if
there is no related Item for the relationship row.
The handle to the grid control.
The name of the Property for the cell column selected.
The column position number in the grid
Page 31
The Methods related to the ItemType via the "Item Action" relationship are called via
the action attribute and the Item.apply() method and can be reviewed by searching
the "Item Actions" Tab on the ItemType.
The Methods related to the ItemType via the "Server Event" relationship are called
by the server as pre and post event callbacks for the primitive server actions: add,
update, delete, and get. And can be reviewed by searching the "Server Events" Tab
on the ItemType.
The Generic Methods can be reviewed by searching the Method Items.
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 32
5 Action Items
An Action Item is how Methods are bound to the client User Interface. Actions
provide the hooks for invoking Methods from the Action menu bar choice or from the
right mouse context popup menu. An Action is invoked on the client side but can call
either a client or server side Method. In both cases the context Item must be
defined.
The item_query Property on the Action Item is used to specify the query used to
populate the context Item. This Property is of data_type="text" because it is
actually an XSLT stylesheet. Simply put the item_query Action Property drives the
content for the context Item for the Action Methods.
The use of a XSLT stylesheet for the item_query is consistent with how Aras
Innovator sends out Email Notifications for Life Cycle promotions both on the State
and on the Transition, on Workflow Activities, and in the Report Tool. The concept is
the XSLT stylesheet is applied to the Item and the result is the AML query, which is
used to get the context Item for the Method. This allows you to basically turn an
Item into a query for the data you want as the context Item for the Method.
The default value for the item_query Action Property is:
If you want all your old actions, created with Innovator 6.1.5 or earlier, that expect
relationships to work, use the following query string:
<Item type="{@type}" id="{@id}" action="get" levels="1"/>
The rules for how the content for the context Item are defined below for both client
and server Methods.
5.1
Copyright 2007
Aras Corporation.
All Rights Reserved.
If no cache Item and no item_query value then the temporary Item with just
the type and id attributes is the context Item for the Method.
If no cache Item and has item_query value then a temporary Item is used
containing just the Item tag with the type and id attributes. The stylesheet
for the item_query is applied to the temporary Item and the result is used as
the AML query for the content for the context Item for the Method.
Page 33
5.2
The stylesheet for the item_query value would be the following, which will
construct the AML format above:
<Item type="{@type}"><id><xsl:value-of select="@id"/></id></Item>
Copyright 2007
Aras Corporation.
All Rights Reserved.
If no cache Item and no item_query value then the temporary Item with just
the type attribute and the id is nested as a Property tag as shown above is
passed as the request triggering the server to do the pre-GetItem levels="0"
as today and the result is the context Item for the Method.
If has cache Item and is dirty and no item_query value then passes the dirty
Item, which is the content for the context Item for the server Method.
If has item_query value but no cache Item then a temporary Item is used
containing just the Item tag with the type and id attributes. Plus the
doGetItem="1" attribute is included, which will force the server to do the preGetItem using this as its query criteria and its results is the content for the
context Item for the server side Method.
If has cache Item and is not dirty and has item_query value applies the
stylesheet to the cached Item and pass that as the Item request. Plus the
doGetItem="1" attribute is included, which will force the server to do the preGetItem using AML passed as the query criteria and the results is the content
for the context Item for the server side Method.
Page 34
5.3
Use Cases
Basic Course of
Events:
Exception Paths:
5.3.2 Client side - no cache Item - no item_query value
Use Case Name:
Summary:
Preconditions:
Basic Course of
Events:
Exception Paths:
5.3.3 Client side - has cache Item not dirty - no item_query value
Use Case Name:
Summary:
Preconditions:
Basic Course of
Events:
Exception Paths:
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 35
5.3.4 Client side - has cache Item not dirty - has item_query value
Use Case Name:
Summary:
Preconditions:
Basic Course of
Events:
Exception Paths:
Client side has cache Item not dirty has item_query value
Invokes client side Item Method and the content for the context Item is
the result from a server request using the result of the XSLT
transformation of the cached Item with the item_query stylesheet as the
AML query server request.
1. That an Item is selected and the type and id for the selected Item is
known by the client.
2. That the ItemType for the selected Item has an "Item Action"
RelationshipType and the Action type="item" and location="client".
1. User selected an Item.
2. Invokes the Action by context menu pick or menu bar Action menu
pick.
The item_query is not a valid XSLT stylesheet.
Preconditions:
Basic Course of
Events:
Exception Paths:
Basic Course of
Events:
Exception Paths:
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 36
Preconditions:
Basic Course of
Events:
Exception Paths:
5.3.8 Server side - has cache Item not dirty - no item_query value
Use Case Name:
Summary:
Preconditions:
Basic Course of
Events:
Exception Paths:
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 37
5.3.9 Server side - has cache Item not dirty - has item_query value
Use Case Name:
Summary:
Preconditions:
Basic Course of
Events:
Exception Paths:
Server side has cache Item not dirty has item_query value
Invokes server side Item Method and the content for the context Item is
the result from a server pre-GetItem where the AML passed is the AML
query, which is the result of the XSLT transformation of the cached Item
with the item_query stylesheet; plus the doGetItem="1" attribute is also
set, which tells the server to do the pre-GetItem using the request AML
as the query, the results is the content for the context Item.
1. That an Item is selected and the type and id for the selected Item is
known by the client.
2. That the ItemType for the selected Item has an "Item Action"
RelationshipType and the Action type="item" and location="server".
1. User selects an Item.
2. Invokes the Action by context menu pick or menu bar Action menu
pick.
The item_query is not a valid XSLT stylesheet.
Preconditions:
Basic Course of
Events:
Exception Paths:
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 38
The AML is the language that drives the Aras Innovator Server.
The Aras Innovator Server is a message based system in that it accepts AML
scripts as messages and returns AML messages. AML document, AML script,
AML message all mean the same thing.
Copyright 2007
Aras Corporation.
All Rights Reserved.
AML documents contain Items, Structure, and Logic, so they are scripts.
The IOM is the Object API used to build and apply AML messages.
Methods implement business logic using the IOM API.
Methods extend the Item Class when used as "Item Action" relationships on
the ItemType, which simulates Object Oriented programming, where the
ItemType is the Class and "Item Action" relationships to Methods are the
Class methods.
Methods are also generic arbitrary business logic that can be called like a sub
routines from other Methods using the IOM Innovator.applyMethod()
method.
Methods follow the Item Factories design pattern; they should return a new
Item and not side effect the context Item.
Server Events are the exception because the purpose is to intercept and
operate on the AML before the server parses it, and before the AML is
returned to the client after the server parses it. So you do modify the context
Item and return nothing.
Implement changes/edits to the context Item in the OnBefore Event by
altering the AML before the server parses it. Refrain from attempting to
update the context Item after the server has already operated on it in the
OnAfter Event. Use the OnAfter Events to update/include federated data in
the response AML.
Use the select, page, and pagesize attributes for the AML queries to
optimize the performance for the request.
Use the generic IOM methods to construct the AML queries rather then
convenience methods like getItemBy_, getRelationships(), or use the
levels attribute because the convenience methods typically return far more
data then required imposing a performance hit.
The context Item is the keyword this Object for JavaScript, C#, and J#, and
the Me Object for VB.Net.
The context Item for Generic Methods is any XML you want but it is highly
recommended that you continue to use AML to represent your data. This
provides the benefit of using the IOM to manage the input for the Generic
Methods.
Page 39
Attributes are used to pass control switches to the Method. You can invent
your own because they are a simple way to pass meta-data to the Method.
7 Cookbook
This section is a Cookbook of recipes to help you solve common tasks while
developing Methods. The examples are shown in JavaScript, C# and VB.Net when
possible.
7.1
C#
VB.Net
7.2
Technique
There are basically two ways to create a new Item Object; by calling the Class
constructor or the factory methods on the Item Object and Aras Innovator Object.
JavaScript
var
var
var
var
var
var
C#
VB.Net
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 40
7.3
You want to query for an Item that you know by id and type.
Technique
There are a few ways to get an Item when you know its id and type, the simplest
being the Innovator.getItemById() method. However, if you need to be granular about
your request then building the query using the IOM is required. This provides the
ability to include controls to limit the results and define the structure to be returned
for the Items found.
JavaScript
C#
VB.Net
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 41
7.4
You want to query for the Items that match some criteria and generate an HTML
Table as the results.
Technique
There is no difference in setting up a query for a single Item or for many. Only the
criteria define the set size returned. In this recipe you create an Item and populate
the query criteria, apply it, and iterating over the Items returned producing a HTML
<TABLE> fragment.
JavaScript
C#
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 42
VB.Net
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 43
7.5
You want to query for an Item and return its configuration in the results.
Technique
To query for an Item and retrieve its structure you build the query as the structure
you want returned. Use the IOM methods to add the relationships you want and
build the structure in the Item. The server will return the structure that follows the
request structure.
This recipe illustrates several related concepts together, which are how to get a set
of Items from an Item and how to iterate over the set, plus how to get the related
Item from the relationship Item.
JavaScript
"<tr>" +
+ bomPart.getProperty("item_number") + "</td>" +
+ bomPart.getProperty("description") + "</td>" +
+ bomPart.getProperty("cost") + "</td>" +
+ bom.getProperty("quantity") + "</td>" +
}
return content + "</table>";
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 44
C#
"" +
+
+
+
+
bomPart.getProperty("item_number") + "</td>" +
bomPart.getProperty("description") + "</td>" +
bomPart.getProperty("cost") + "</td>" +
bom.getProperty("quantity") + "</td>" +
}
content += "</table>";
return innovator.newResult(content);
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 45
VB.Net
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 46
7.6
You want to perform a query using the AML to construct the query criteria.
Technique
Create an Item Object but use the Item.loadAML() method to populate the Item.
JavaScript
7.7
You want to get the next promotion states for an Item and use the states as the
choices for a dropdown control.
Technique
Use the Item.getNextStates() method to get the next state values. This recipe
assumes there is a select input field on the form for us to populate with state values.
HTML
<select id="mySelect"></select>
JavaScript
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 47
7.8
You want to search for an Item using the relationship and related Items as search
criteria. In this recipe we will get the User Item that matches the Identity name as
an Alias relationship to the User Item.
Technique
The following are some key points to understand when constructing an AML query:
1. Use the get action on the relationship Items to include it as search criteria.
a. Without the get action the relationship Item is ignored as search
criteria.
2. Include the related_id property name in the select attribute for the
relationship Item if you want to return the related Item nested inside the
related_id property in the results.
<Item type="Part BOM" select="quantity,related_id"/>
a. Use () to include the select attribute value for the related Item inside
the select attribute for the relationship Item.
<Item type="Part BOM" select="quantity,related_id(item_number,description)"/>
3. The select attribute for the nested Item tag for the related_id property has
higher precedence over the select value inside the () for the relationship's
select attribute.
4. The get action is not required for the nested Item tag for the related_id
property to include it as search criteria.
These two AML scripts are equivalent queries for selecting the name property
for the related Item:
<Item type="User" action="get" select="first_name,last_name,email">
<Relationships>
<Item type="alias" action="get" select="related_id(name)"/>
</Relationships>
</Item>
<Item type="User" action="get" select="first_name,last_name,email">
<Relationships>
<Item type="alias" action="get" select="related_id">
<related_id>
<Item type="Identity" action="get" select="name"/>
</related_id>
</Item>
</Relationships>
</Item>
Clearly the first example is simpler and requires less coding (referring to the
IOM logic that would construct the AML) and is the recommended style when
all you require is specifying a select for the related Item for the query.
But the second style opens the opportunity to now include additional search
criteria for the related Item.
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 48
AML
JavaScript
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 49
7.9
Technique
Adding an Item configuration is done by building the Item structure using the IOM
methods.
JavaScript
Technique
The following is the same thing but will use the Item.loadAML() method to populate
the Item Object with AML text.
JavaScript
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 50
Technique
Use the Item Class Extended Method set to set a new private Permission for an Item.
JavaScript
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 51
You want to write Generic Methods that can be used as subroutines for other
Methods.
Technique
Use the Innovator.applyMethod() method to apply Generic Methods. The following
examples assume a server-side method named "Reverse String" exists, and that it
returns a result item containing the reversed contents of the <string> tag.
JavaScript
C#
VB.Net
Technique
Edit the method-config.xml file located in the Server folder for the Aras Innovator
install. Search for the <Template> tag for the language you are using and include any
additional namespaces you need by adding additional "using" lines.
<Template name="CSharp" line_number_offset="19">
using System.Text;
// Now you can use the System.Text.UTF8Encoding method in your Method.
byte[] info = new UTF8Encoding(true).GetBytes(this.dom.InnerXml);
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 52
Technique
On the client side use the vault control to write to a text file.
JavaScript
with (top.aras.vault)
{
fileCreate(filePath);
fileOpenAppend(filePath);
fileWriteLine('<AML><Item type="MyItemType"/></AML>');
fileClose();
}
Technique
On the server side use the File and StreamWriter namespaces to write to a text file.
C#
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 53
VB.Net
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 54
Technique
In HTML code use the assembly name, the control name (e.g. TreeTable and
GridContainer respectively in the code sample below), the special <object> tag and
appropriate control event handlers to download/activate control on the page. Make
sure that all the event handlers for the control are placed in HTML code above the
<object> tag:
HTML Code
- for a separate web page, the special function, named WriteUncommentedObject in
the code sample below, gives the work around for Security Update MS06013(912812):
<html>
<head>
<script type="text/javascript"
src="../javascript/AddConfigurationLink.js">TreeTable</script>
</head>
<body>
<script type="text/javascript" for="MyGrid" event="GridClick(rowId, col)">
alert("rowId:" + rowId + ", col:" + col);
</script>
<script type="text/javascript" for="MyGrid" event="GridStart(isSuccess)">
if (isSuccess) {
addRow("row1","Row 1","row1");
addRow("row2","Row 2","row2");
}
</script>
<comment id="MyGrid_commented">
<object id="MyGrid"
style="width:100px; height:100px; visibility:visible;"
classid="../cbin/TreeTable.dll#Aras.Client.Controls.GridContainer">
</object>
</comment>
<script type="text/javascript">
WriteUncommentedObject("MyGrid_commented");
</script>
</body>
</html>
- for a field on an Aras Innovator form, the form internally takes care of work around
for MS06-013(912812):
<script type="text/javascript">
top.aras.uiAddConfigLink2Doc4Assembly(document, "TreeTable");
</script>
<script type="text/javascript" for="MyGrid" event="GridStart(isSuccess)">
if (isSuccess) {
addRow("row1","Row 1","row1");
addRow("row2","Row 2","row2");
}
</script>
<script type="text/javascript" for="MyGrid" event="GridClick(rowId, col)">
alert("rowId:" + rowId + ", col:" + col);
</script>
<object id="MyGrid"
style="width:100px; height:100px;"
classid="../cbin/TreeTable.dll#Aras.Client.Controls.GridContainer">
</object>
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 55
You want to query the DB directly bypassing Innovator logic to get the data faster.
Technique
Use the Innovator.applySQL() method to submit SQL direct to the database. This
recipe returns the XML from the applySQL() method and forms HTML for a table to
display the data.
C#
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 56
You want to call a client side Method when the Relationships Grid row is selected to
deselect the row if it is not a new relationship row.
Technique
Add the Grid Event relationship to a Method as the callback for the OnSelectRow
event.
The Method gets three arguments: relationshipID, relatedID and gridApplet. The
relationshipID is the ID for the relationship Item for the selected row. The relatedID
is the ID for the related Item for the selected row. The gridApplet is a handle to the
grid control object.
The relationshipID is also the ID for the grid control row. This recipe will call the
gridApplet Deselect() method if the relationship Item for the selected row if the
relationship has not been modified.
JavaScript
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 57
You want to call a client side Method when the Relationships Grid cell is selected to
blur the cell and prevent editing the cell value.
Technique
Add the Event relationship to a Property as the callback for the OnEditCell event.
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 58
You want to show the relationships for the context Item in a Grid control on the Item
Form.
Technique
Add an HTML Field (positioned at Point(300,10) in the code sample below) and insert
an HTML code than defines the <object>tag to hold the dynamically populated grid
and the JavaScript to get the populating grid relationships.
HTML Field code
<script type="text/javascript">
top.aras.uiAddConfigLink2Doc4Assembly(document, "TreeTable");
</script>
<object id="MyGrid"
style="width:expression(body.clientWidth - 500); height:expression(body.clientHeight 100);"
classid="../cbin/TreeTable.dll#Aras.Client.Controls.GridContainer">
</object>
<script type="text/javascript">
var myCount = 0;
function MyOnloadHandler() {
// Make sure the item is loaded before proceeding
if (!document.thisItem) {
if (myCount > 9) { return; }
myCount++;
setTimeout("MyOnloadHandler()", 300);
return;
}
var item = document.thisItem;
// Get the relationships
var qry = item.newItem("Part BOM", "get");
qry.setAttribute("select", "quantity,related_id(item_number,name,cost)");
qry.setProperty("source_id", item.getID());
var results = qry.apply();
if (results.getItemCount() < 0) {
top.aras.AlertError(results.getErrorDetail());
return;
}
// Populate the grid with the results.
populateGrid(item, results);
}
function populateGrid(item, results) {
var propNameArr = new Array("item_number", "name", "cost");
var gridXml =
"<table editable='false' draw_grid='true'>" +
"<columns>" +
"<column width='30%' align='left' />" +
"<column width='40%' align='left' />" +
"<column width='15%' align='right' />" +
"<column width='15%' align='right' />" +
"</columns>" +
"<thead>" +
"<th>Part Number</th>" +
"<th>Name</th>" +
"<th>Cost</th>" +
"<th>Quantity</th>" +
"</thead>" +
"</table>";
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 59
You want to show the relationships for the context Item in an Excel web component
on the Item Form.
Technique
Using the Form Tool we add an HTML Field to the Form, which we will use to insert
the HTML and JavaScript code for displaying the Excel web component for the "Part
BOM" relationships for the document.thisItem context Part Item.
Add an HTML Field and insert the following code, which defines an <object> tag to
hold the dynamically populated Excel document plus the JavaScript code to get the
relationships to populate the control. Please note that the use of Excel components
is heavily dependent on the client security settings, and may not work in all
environments. The form internally handles the workaround for MS06-013(912812).
HTML Field code
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 60
var c = results.getItemCount();
for (var i=0; i<c; ++i) {
var bom = results.getItemByIndex(i);
var part = bom.getRelatedItem();
sheet.Cells(i+row,1).Value = part.getProperty('item_number');
sheet.Cells(i+row,2).Value = part.getProperty('name');
sheet.Cells(i+row,3).Value = part.getProperty('cost');
sheet.Cells(i+row,4).Value = bom.getProperty('quantity');
sheet.Range("A1:D1").EntireColumn.AutoFit();
}
}
window.attachEvent("onload", MyOnloadHandler);
</script>
You want to open the relationships for the context Item in an Excel document outside
the Form.
Technique
Using the Form Tool we add an HTML Field to the Form, which we will use to insert
the HTML and JavaScript code for displaying the Excel document for the "My BOM"
relationships for the document.thisItem context Part Item.
Add a HTML Field and insert the following code, which defines a <button> tag to call
the JavaScript code to get the relationships to populate the control. Please note that
the use of Excel automation is heavily dependent on the client security settings, and
may not work in all environments.
HTML Field code
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 61
You want to use a Tabbar control on the Form to page the various relationships for
the context Item as shown on the figure below:
Technique
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 62
Use a Tabbar control to page between Grid styles. The code sample below shows the
HTML and JavaScript for the tabbar control only. Reuse technique illustrated in 7.17
to implement Grids the tabbar is paging.
HTML code
<script type="text/javascript">
top.aras.uiAddConfigLink2Doc4Assembly(document, "SimpleTabbar");
top.aras.uiAddConfigLink2Doc4Assembly(document, "TreeTable");
</script>
<script type="text/javascript" for="MyTab" event="OnStart()">
AddTab("grid", "BOM (Grid Control)");
AddTab("excel", "BOM (Excel Spreadsheet)");
AddTab("html", "BOM (HTML Table)");
SelectTab("grid");
</script>
<script type="text/javascript" for="MyGrid" event="GridStart()">
DrawGrid= true;
AddRow("row1","BOM Goes Here","row1");
</script>
<script type="text/javascript" for="MyTab" event="OnClick(tabId)">
if (tabId == 'grid') {
document.all.MyExcel.style.display = 'none';
document.all.MyGrid.style.display = 'block';
document.all.MyTable.style.display = 'none';
} else if (tabId == 'excel') {
document.all.MyExcel.style.display = 'block';
document.all.MyGrid.style.display = 'none';
document.all.MyTable.style.display = 'none';
document.all.MyExcel.Cells(1,1).Value = "BOM Goes Here";
} else if (tabId == 'html') {
document.all.MyExcel.style.display = 'none';
document.all.MyGrid.style.display = 'none';
document.all.MyTable.style.display = 'block';
}
</script>
<object id="MyTab"
classId="../cbin/SimpleTabbar.dll#Aras.Client.Controls.SimpleTabbar"
style="height:25px; width:500px;">
</object>
<object classid="clsid:0002E559-0000-0000-C000-000000000046" id="MyExcel"
style="height:100px; width:500px; display:none;">
<param name="DisplayTitleBar" value="false">
<b>Unable to open Excel</b>
</object>
<object id="MyGrid"
style="height:100px; width:500px; display:none;"
classid="../cbin/TreeTable.dll#Aras.Client.Controls.GridContainer">
</object>
<table id="MyTable" style="height:100px; width:500px; display:none; border-style:solid;
border-width:2;">
<tr><td>BOM Goes Here</td></tr>
</table>
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 63
Technique
Use the classic Aras Innovator API top.aras.getIdentityList() method, which
returns a comma delimited string of ID's.
Note that the classic API will eventually be eliminated and this method will become
available on the IOM Innovator object as Innovator.getIdentityList().
JavaScript
// This will get an array of identity IDs from the client cache
var myIdentityIDs = top.aras.getIdentityList().split(',');
// This will requery the server for the same list (for use when it's changed in-session)
// var myIdentityIDs = top.aras.buildIdentityList().split(',');
Technique
Use the classic Aras Innovator API top.aras.getNetSequence() method, which returns a
the next sequence value from the server.
Note that the classic API will eventually be eliminated and this method will become
available on the IOM Innovator object as Innovator.getNetSequence().
Using the Form Tool we add an HTML Field to the Form, which we will use to insert
the HTML and JavaScript code for to provide the button to get the next sequence
value and update the Field value and client cache.
HTML Field code
<a href="javascript:getNextNumber();">
<img src="../images/icons/16x16/16x16_sequence.gif" border="0">
</a>
<script>
function getNextNumber() {
// Get a handle to the field object.
// The ID for the field is the property name with _system suffix.
var field = document.getElementById("item_number_system");
// Get the next sequence value.
var seq = top.aras.getNextSequence("","Default Part");
field.value = seq;
// This will update the client cache with the new value.
handleItemChange("item_number", field.value);
}
</script>
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 64
You want to get an existing File from the Vault and attach it to a new Document
Technique
This is similar to the last recipe but will use the getItemByKeyedName() method to get an
existing File Item instead of creating a new one.
JavaScript
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 65
// Prompt the user for the file name and retrieve the File item
var fileName = prompt("Enter the File Name:","");
var innovator = this.newInnovator();
var fileItem = innovator.getItemByKeyedName("File",fileName);
if (fileItem.isError()) {
top.aras.AlertError("File Not Found: " +fileItem.getErrorDetail());
return;
}
// Get the URL to the file and download it
var fileURL = top.aras.getFileURLEx(fileItem.node);
var folder = top.aras.vault.GetWorkingDir();
var results = top.aras.vault.downloadFile(fileURL);
if (!results) {
top.aras.AlertError("Unable to retrieve the file from the vault");
return;
}
// Open the file in Word.
try {
var word = new ActiveXObject("Word.Application");
word.visible = true;
word.documents.open(folder + "\\" + fileName);
} catch(e) {
top.aras.AlertError("Unable to launch Word. File saved as: "+folder+fileName);
return;
}
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 66
Technique
Use the Pre Server Method on the Life Cycle Transition to call a server side Method to
validate the Item before it is promoted and if invalid rejects the Promote by
returning an Error Item.
C#
VB.Net
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 67
The XML document for a grid may contain the following tags:
<table> Tag
Attribute
icon0
Type
String
icon1
icon2
icon3
iconchk0
String
String
String
String
IconCheckBox0
iconchk1
String
IconCheckBox1
sort_up
String
IconSortUp
sort_down
String
IconSortDown
sel_bgcolor
String
SelBGColor
sel_textcolor
String
SelTextColor
font
draw_grid
String
Boolean
Font
DrawGrid
nosort
editable
norowselect
multiselect
Boolean
Boolean
Boolean
Boolean
NoSort
Editable
NoRowSelect
column_draggable
Boolean
ColumnDraggable
noheader
hide_on_load
Boolean
Boolean
NoHeader
HideOnLoad
input_row
Boolean
InputRow
column_resizable
fixedcols
Boolean
Integer
ColumnResizable
ColumnFixed
enterastab
Boolean
EnterAsTab
thinborder
Boolean
ThinBorder
bginvert
Boolean
BGInvert
justify
headerflat
fillheaderspace
Boolean
Boolean
Boolean
Justify
HeaderFlat
HideHeaderSpace
zebra
Boolean
Zebra
sortoninsert
Boolean
SortOnInsert
Copyright 2007
Aras Corporation.
All Rights Reserved.
Property
Comments
Image for root nodes. The icon0 icon3 can be used
with the IM0 and IM1 parameters.
Image for terminal nodes.
Image for non-terminal opened nodes.
Image for non-terminal closed nodes.
Specifies the name of the image for checkbox state 0
(unchecked). For TreeGrid only.
Specifies the name of the image for checkbox state 1
(checked). For TreeGrid only.
Specify the images to display in header cells to show
sort direction.
Specify the images to display in header cells to show
sort direction.
Set the background for the row when selected. This
color will be ORed with each cell background color.
Set the text color for the row. This color will be Ored
with each cell text color. So #FFFFFF will make black
text be white when selected, and blue one is yellow.
The default text font.
Draw vertical and horizontal grid lines. Default is
true.
Makes grid non sortable. Default is false.
Makes cells of the grid editable. Default is false.
Disable row selection when clicked. Default is false.
Enable multi-select (with ctrl-key down). Default is
false.
Enable column dragging. Column index is not
changed, only visual feature. Default is false.
Hide the header if value = 1. Default is 0 (false).
Disables the initial paint and the control will not
appear until you call showContent() method. Default
is false.
Enables an input row not-scrollable above the
header.
Enable column resizing. Default is true.
Fix the first n columns, so they do not scroll. Must be
> 0.
If specified (true), enter key will work as tab move
to the next column, otherwise (false) move to the
next row same column. Default is true.
If true, cells have thin border, false has visible
white border. Default is false.
Enable background row color inverting when
selected. Default is true.
Enables cell content wrapping. Default is false.
Set the header with flat border. Default is false.
If specified, the free space on the right of the grid
will be filled with bgcolor rather than header color.
Default is true.
Define 2 colors (comma separated), that will
alternate between rows. Default is false.
Enables resorting as rows are inserted. Default is
false.
Page 68
enablehtml
delim
Boolean
String
EnableHTML
Delimeter
Default is true.
Set the delimiter character.
<menu> Tag
The <menu> tag has no attributes. Contains <menuitem> and <separator> tags.
<menuitem> Tag
Attribute
label
Type
String
Comments
<separator> Tag
<thead> Tag
Attribute
height
Type
String
Height in pixels.
Comments
<th> Tag
<columns> Tag
<column> Tag
Attribute
width
Align
Order
Edit
bginvert
resizable
visible
Sort
inputformat
locale
password
Type
Integer
String
Integer
String
Boolean
Boolean
Boolean
String
String
String
Boolean
Comments
Width in pixels.
Text alignment.
The column order.
NOEDIT|FIELD:maxlen|COMBO:listId|WIDGET:class
Invert background color of selected cell from this column.
Column is resizable.
Column is visible.
NOSORT|NUMERIC|DATE
Display cell value as * in UI. To protect data.
<inputrow> Tag
The <inputrow> tag defines the input row, has no attributes, and contains <td>
tags.
<tr> Tag
The <tr> tag defines a row. Contains <td>, <tr>, and <userdata> tags.
Attribute
id
action
Copyright 2007
Aras Corporation.
All Rights Reserved.
Type
String
String
Comments
Row ID.
Parameters to pass into GridClick event handler.
Page 69
bold
selected
height
icon0
icon1
expanded
Boolean
Boolean
Integer
String
String
Boolean
Height in pixels.
Open icon. For TreeGrid only.
Close icon. For TreeGrid only.
Display node as expanded on initial load.
<td> Tag
Attribute
font
textcolor
bgcolor
link
align
underline
strikethrough
Type
String
String
String
String
String
Boolean
Boolean
<userdata> Tag
The
<userdata>
Attribute
key
value
Type
String
String
Font.
Set the foreground color.
Set the background color.
Comments
Text alignment.
Comments
<list> Tag
Attribute
id
Type
String
Comments
<listitem> Tag
Attribute
label
value
Copyright 2007
Aras Corporation.
All Rights Reserved.
Type
String
String
Comments
Page 70
The XML document for a menu may contain the following tags:
<menuapplet> Tag
Attribute
show
Type
String
bgcolor
fgcolor
top_border
bottom_border
left_border
right_border
String
String
Boolean
Boolean
Boolean
Boolean
Comments
The identifier of visible toolbar. If this parameter is absent, first menubar
from list will be visible.
0
0
0
0
or
or
or
or
1.
1.
1.
1.
<menubar> Tag
Attribute
id
Type
String
Comments
<item> Tag
<checkitem> Tag
<seperator> Tag
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 71
8 .NET Controls
There are number of .NET controls that are used by the Aras Innovator Client, which
can be programmatically controlled from the client side Methods. Plus you can use
these controls when constructing your own user interfaces.
Within an HTML page, each control may be initialized by tag <OBJECT> with the
attribute classID that has two parts: the path to the .Net assembly, and the fully
qualified class name of the control, separated by the pound sign:
classid="../cbin/[assembly_name]#Aras.Client.Controls.[class_name]"
The .NET controls described in this section are listed in the table below:
Control
assembly_name
class_name
TREE GRID
TreeTable.dll
TreeGridContainer
GRID
EXCEL GRID
MENU BAR
WORKFLOW
TOOLBAR
STRUCTURE
GANTT
STATUS BAR
UTILITY CONTROL
TABBAR
CALENDAR
VAULT
COLOR DIALOG
TreeTable.dll
TreeTable.dll
MainMenu.dll
Workflow.dll
Toolbar.dll
Structure.dll
Gantt.dll
StatusBar.dll
Utils.dll
SimpleTabbar.dll
Calendar.dll
Vault.dll
ColorDialog.dll
GridContainer
ExcelGrid
MainMenu
WorkflowContainer
Toolbar
Structure
ProjectTree
StatusBar
Utils
SimpleTabbar
Calendar
VaultApplet
ColorDialog
These controls expose public methods and properties via members of COM interfaces
that in their turn return COM interfaces and get COM interfaces as parameters. This
section provides just a generic characteristic of the controls. You can get a detailed
API reference of the controls by one of the following means:
- On-line. Go to
http://www.aras.com/support/documentation/documentation.aspx?version=8.1.1
Under the section Tools, Utilities and Programmers Guides select On-Line
API Guide.html
- From Innovator Client UI. Login as Innovator Administrator. Under the Help
menu select API Reference
- In Innovator CD Image. Go to the documentation folder and open Aras
Innovator - API Guide.html
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 72
8.1
Grid/TreeGrid/ExcelGrid Control
classid="../cbin/TreeTable.dll#Aras.Client.Controls.GridContainer"
8.1.1
or with JavaScript using method InitXML() that loads XML string/url into the grid.
See also How to build XML for a Gridfor more details on what tags to use when
constracting grid xml.
8.1.2
8.1.3
8.1.4
ExcelGrid Methods
8.1.5
Cell Methods
Methods that are used to control a Grid: e.g. add/remove row, add cell content, etc.
are exposed via IGridComIncoming interface while IGridComEvents interface is used
to expose GridContainer events to COM clients.
Methods that are used to control a TreeGrid, e.g. add, remove, open, and close a
Tree item are exposed via ITreeGridComIncoming Interface while
ITreeGridComEvents interface is used to expose TreeGridContainer events to COM
clients. As these interfaces extend IGridComIncoming and IGridComEvents
respectively all the members of Grid control public API are available for TreeGrid
control as well.
Methods that are used to control an ExcelGrid are exposed via
IExcelGridComIncoming interface. As this interface extends the IGridComIncoming
interface all the members of IGridComIncoming are available for ExcelGrid control as
well.
Methods that are used to control a Cell Object for all grid controls are exposed via
ICellComIncoming interface. You can get a handle to the Cell Object from the Grid
using methods like Cells(), GetSelectedCell(), and GetCurCell() that return
ICellComIncoming type and then use methods from ICellComIncoming interface to
manage a Cell. A handle to a Cell may be also obtained in event handling scripts
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 73
ContextMenu Methods
8.2
Menu bar
8.2.1
Methods that are used to control a popup menu associated with the Grid and other
controls are exposed via IContextMenuWrapperComIncoming interface. You can get
a handle to the ContextMenu Object from the Grid using GetMenu(). It also can be
obtained in event handling scripts using OnMenuShow() method of
IWorkflowComEvents interface. See section 8.3 for more details on Worklow control.
The menubar control supports all standard types of menu elements; you can specify
more than one menu bar for one control and switch between them via JavaScript.
The menubar control can be initialized within HTML page:
<object id="menu" classId="../cbin/MainMenu.dll#Aras.Client.Controls.MainMenu"
style="width:100%; height:100%;" align="baseline">
<param name="XML" value=[xml_url]>
</object>
See also How to build XML for a Menu for more details on what tags to use in the
menubar xml.
.
8.2.2
8.2.3
Two methods FindMenu() and FindItem() to control menu are exposed via
IMainMenuComIncoming interface while IMainMenuComEvents interface is used to
expose MainMenu events to COM clients.
There are three types of menu items:
- Non-terminal element (controlled by methods from IMenuContainerComIncoming
interface).
- Simple terminal element (controlled by methods from IMenuElementComIncoming
interface).
- Checkbox type terminal element (controlled by methods from
IMenuCheckedElementComIncoming interface).
You can get a handle to an object that implement one of these interfaces using
FindItem() method from a MainMenu object or from any of non-terminal element
objects or obtain it in event handling scripts using OnCheck() and/or OnSelect()
methods of IMainMenuComEvents interface.
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 74
8.3
Workflow
8.3.1
or with JavaScript using method Load() that loads XML string/url into the workflow.
8.3.2
8.3.3
8.4
Toolbar
8.4.1
8.4.2
8.4.3
Methods that are used to load and control a Workflow, e.g. add, delete, and get a
Workflow items are exposed via IWorkflowComIncoming interface while
IWorkflowComEvents interface is used to expose Workflow events to COM clients.
There are two methods LoadToolbarFromStr() and LoadXml() to load XML into
toolbar with JavaScript. First method loads XML string and second loads the given
url.
Methods that are used to load and control a Toolbar, including hide, show and get a
Toolbar items are exposed via IToolbarComIncoming interface while
IToolbarComEvents interface is used to expose Toolbar events to COM clients.
Methods that are used to control an Active Toolbar Object are exposed via
ITToolbarComIncoming interface. You can get a handle to an Active Toolbar Object
from the Toolbar using method GetActiveToolbar() and then use members of
ITToolbarComIncoming interface to manage an Active Toolbar.
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 75
8.4.4
8.5
Structure
8.5.1
8.5.2
8.6
Gantt
8.6.1
The classId with Gantt.dll is used as a container for ProjectTree, Task, Dependency,
and WBS objects and their COM interfaces.
Use method Load() to load XML from the given URL into a Project Tree with
JavaScript.
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 76
8.6.2
ProjectTree Methods
8.6.3
Task Methods
8.6.4
Dependency Methods
8.7
Status Bar
8.7.1
8.7.2
8.8
Utility Control
8.8.1
Utility Methods
8.8.2
Balloon Methods
Use method Load() to load XML from the given URL into status bar with JavaScript.
Methods that are used to load and control a Status Bar, including clear status, set
default message, set image, etc. are exposed via IStatusBarComIncoming interface.
The classid with Utils.dll is used as a container for Utility, Balloon, and Splash Screen
objects and their COM interfaces.
The collection of miscellaneous utility methods such as getter and setter for
DragFullWindows property and boolean CheckThatFullTrustIsSetForSite() as
well as methods returning instance of Balloon and Splash Screen objects are exposed
via IUtilsComIncoming interface.
Methods that are used to control a Balloon are exposed via IBalloonComIncoming
interface. You can get a handle to a Balloon Object from the Utility Control using
GetBalloon() method of IUtilsComIncoming interface.
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 77
8.8.3
8.9
Other Controls
8.9.1
8.9.2
8.9.3
8.9.4
The SimpleTabbar control methods and events are exposed to the COM clients via
ISimpleTabbarComIncoming and ISimpleTabbarComEvents interfaces respectively.
There is no method available to return a handle to an individual tab Object.
The properties and methods to control a Calendar are exposed via
ICalendarComIncoming interface while ICalendarComEvents interface is used to
expose Calendar events to COM client.
Methods to control a Vault are exposed via IVaultComIncoming interface while
IVaultComEvents interface is used to expose the only Calendar event Onload() to
COM client.
The IColorDialogComIncoming interface is to expose a single method GetColor()
of a Color Dialog object.
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 78
9.1
Features
The Solution Studio offers several useful features to help aid you in the development
of your Methods.
Color coding the keywords for the language you are developing in.
An online help interface that is context sensitive for the methods selected in
the code guide.
Syntax checking based on the language you are developing in.
Undo/Redo
Syntax checker
Search/Replace
IOM API
Code Guide
Keyword
Color Coding
Copyright 2007
Aras Corporation.
All Rights Reserved.
IOM API
Online Help
Page 79
10 Debugging
Aras Innovator has the following features for debugging/logging your Methods:
Uncheck the boxes except for the 'Common Language Runtime' and click OK.
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 80
Select the Advanced tab and make sure the "Disable Script Debugging" is
turned off and "Display notification about script errors" is turned on.
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 81
Run the Method and the application will open the "Microsoft Visual Studio
.NET 2003" debugger and break on the debugger line.
In order to write messages to the C:/TEMP/DEBUG-* log file, add the following lines
of code to the server side method:
Dim sc as Object = Me.serverConnection
sc.cco.startup.debuglog("Unique string to identify message in log file", "Actual
message written to log file")
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 82
11 External APIs
There are a few ways to connect to the Aras Innovator server from other
applications. Aras provides two client controls (.NET and ActiveX) that implement
the IOM API and can be embedded in other applications. Alternatively, simple SOAP
communication can be used to connect to Aras Innovator.
An IOM ActiveX control is included in the Aras Innovator installation and delivered as
part of the ArasIOM.cab cabinet file in the Innovator\Client\cbin directory. This
control can be used to build Windows applications (in VB6 or VC++, for example) or
Windows Scripting Host applications (VBScript or Jscript).
The ActiveX control is implemented as a DLL file that you must register in order to
use. The steps to do so are as follows:
To connect to the Aras Innovator server, you must first create a new instance of an
Innovator object and set the connection parameters/credentials. You may then use
the Innovator.login() method to establish a session. Once the session is established,
you can create new Item objects and operate on them. To end the session, you
should call the Innovator.logout() method.
The following is a VBScript example:
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 83
Although not normally suggested, it is possible to circumvent IOM and use SOAP
requests to interact with Aras Innovator. You may use the Microsoft XMLHTTP
Object to send the AML to the Aras Innovator Server.
The following is a VBScript example:
Dim innovatorServer
innovatorServer = "http://localhost/InnovatorServer/Server/InnovatorServer.aspx"
Dim database: database = "innovator81"
Dim loginName: loginName = "admin"
Dim password: password = "607920b64fe136f9ab2389e371852af2" 'MD5 hash of the password
Dim soapStart: soapStart = _
"<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' " &_
"encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'><SOAP-ENV:Body>"
Dim soapEnd: soapEnd = "</SOAP-ENV:Body></SOAP-ENV:Envelope>"
Dim soapAction: soapAction = "ApplyItem"
Dim body: body = "<Item type='User' action='get' select='login_name'/>"
Dim soap
soap = soapStart & "<" & SOAPAction & " xmlns:m='http://www.aras-corp.com/'>" &_
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 84
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 85
Was
(client JavaScript)
aras.applyAML(String AML)
aras.soap.send(
'ApplySQL',
'<sql/>');
aras.applyMethod(
String method-name,
String body)
Is
(JavaScript, C#, and
VB.Net)
Innovator.applyAML(
String AML)
Innovator.applySQL(
String SQL)
Innovator.applyMethod(
String method-name,
String body,
String location?)
CreateXMLDocument()
aras.createXMLDocument()
Innovator.newItem(
String itemtype-name,
String action)
N/A
CreateXMLDocument
aras.createXMLDocument()
GetRequestItem inDom
Server.MapPath
itemDom.selectSingleNode('Item'
)
aras.generateNewGUID()
aras.login()
aras.logout()
N/A
Innovator.newError(String
detail)
Innovator.newResult(String
text)
Innovator.newXMLDocument
()
Innovator.getItemInDom(D
OM dom)
Innovator.getNewID()
Innovator.login()
Innovator.logout()
Innovator.MapPath(String
file-path)
aras.applyItem(String body)
itemDom.transformNode()
aras.applyXsltFile(
DOM itemDom,
String XSLT-filename)
CreateXMLDocument()
itemDom.loadXML AML
itemDom.cloneNode()
itemDom.setAttribute(
"id",
NewID())
itemDom.getAttribute('isNew')
HasFault(
DOM itemDom,
Boolean ignoreZeroFault)
DOM API
Copyright 2007
Aras Corporation.
All Rights Reserved.
N/A
aras.applyXsltString(
DOM itemDom,
String XSLT-string)
aras.createXMLDocument()
itemDom.loadXML(String AML)
itemDom.cloneNode()
itemDom.setAttribute(
'id', aras.generateNewGUID())
itemDom.getAttribute('isNew')
aras.hasFault(
DOM itemDom,
Boolean ignoreZeroFault)
DOM API
Item.apply(
String action,
String args-object,
String location)
Item.applyStylesheet(
String xsl-stylesheet,
String type)
Item.newXMLDocument()
Item.loadAML(String AML)
Item.clone(
String clone-relationships)
Item.setNewID()
Item.isNew()
Item.isError()
Item.isRoot()
Page 86
itemDom.selectNodes(XPath).length
HasFault(DOM itemDom, 1)
IsLocked(
String itemTypeID,
String itemID,
DOM outDom)
itemDom.getAttribute(
String attribute-name)
itemDom.setAttribute(
String attribute-name,
String value)
itemDom.getAttribute('action')
itemDom.setAttribute('action', String
action)
itemDom.getAttribute('id')
itemDom.setAttribute('id', String id)
itemDom.getAttribute('type')
itemDom.setAttribute('type',
String item-type-name)
GetItemProperty(
DOM itemDom,
String property-name)
SetItemProperty(
DOM itemDom,
String property-name,
String value)
itemDom.selectSingleNode(
String propertyname).getAttribute('condition')
itemDom.selectSingleNode(
String propertyname).getAttribute(String attributename)
itemDom.selectSingleNode(
String property-name).setAttribute(
String attribute-name,
String value)
itemDom.selectNodes(XPath).len
gth
aras.hasFault(DOM itemDom, 1)
aras.isLocked(DOM itemDom)
Item.isCollection
itemDom.getAttribute(
String attribute-name)
Item.getAttrribute(
String attribute-name,
?String default-value)
Item.setAttrribute(
String attribute-name,
String value)
Item.getAction()
Item.setAction(String
action)
Item.getID()
Item.setID(String id)
itemDom.setAttribute(
String attribute-name,
String value)
itemDom.getAttribute('action')
itemDom.setAttribute('action',
String action)
itemDom.getAttribute('id')
itemDom.setAttribute('id', String
id)
itemDom.getAttribute('type')
itemDom.setAttribute('type',
String item-type-name)
aras.getItemProperty(
DOM itemDom,
String property-name)
aras.setItemProperty(
DOM itemDom,
String property-name,
String value)
itemDom.selectSingleNode(
String propertyname).getAttribute('condition')
itemDom.selectSingleNode(
String propertyname).getAttribute(String
attribute-name)
Item.isEmpty()
Item.isLocked()
Item.getType()
Item.setType(
String item-type-name)
Item.getProperty(
String property-name,
String default-value)
Item.setProperty(
String property-name,
String value,
String condition)
Item.getPropertyCondition(
String property-name)
Item.getPropertyAttribute(
String property-name,
String attribute-name,
String default-value)
itemDom.selectSingleNode(
String propertyname).setAttribute(
String attribute-name,
String value)
itemDom.selectSingleNode(
String XPath)
itemDom.appendChild(Node
item)
Item.setPropertyAttribute(
String property-name,
String attribute-name,
String value)
itemDom.removeChild(Node item)
itemDom.removeChild(Node
item)
Item.removeProperty(
String property-name)
itemDom.selectSingleNode(
String XPath)
Item.getFileName()
ApplyItem(
DOM itemDom,
DOM outDom)
itemDom.selectSingleNode(
String XPath)
aras.setItemProperty(
DOM itemDom
String file-name)
aras.getRelationships(
DOM itemDom,
String itemtype-name)
itemDom.appendChild(
DOM itemDom)
itemDom.appendChild(
DOM itemDom)
Item.addRelationship(Item
item)
itemDom.selectSingleNode(
String XPath)
itemDom.appendChild(Node item)
Copyright 2007
Aras Corporation.
All Rights Reserved.
Item.getPropertyItem(
String property-name)
Item.setPropertyItem(
String property-name,
Item item)
Item.setFileName(
String file-name)
Item.getRelationships(
String itemtype-name,
String select,
String order-by)
Page 87
itemDom.removeChild(Node item)
itemDom.removeChild(Node
item)
aras.getRelatedItem(
DOM itemDom)
itemDom.appendChild(
DOM itemDom)
itemDom.parentNode.parentNode
()
itemDom.selectSingleNode('../..')
itemDom.selectNodes(XPath).len
gth
itemDom.selectSingleNode(
String XPath)
itemDom.selectNodes(String
XPath)
itemDom.appendChild(Node
item)
itemDom.removeChild(Node
item)
DOM API or AML string
concatenation.
DOM API or AML string
concatenation.
DOM API or AML string
concatenation.
Item.removeRelationship(Ite
m item)
Item.getRelatedItem()
Item.getLogicalItems()
itemDom.removeChild(Node)
itemDom.selectNodes(String
XPath)
itemDom.removeChild(Node)
CreateXMLDocument()
aras.createXMLDocument()
Item.newItem(
String itemtype-name,
String action)
N/A
itemDom.selectSingleNode('//detail').t
ext
N/A
N/A
soapObj.getFaultDetails()
Item.newInnovator()
Item.getErrorDetail()
N/A
N/A
N/A
N/A
N/A
Item.setErrorDetail(
String detail)
Item.getErrorString()
Item.setErrorString(
String error-message)
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
itemDom.selectSingleNode('//Result')
soapObj.getResults()
itemDom.selectSingleNode(
String XPath)
itemDom.appendChild(
DOM itemDom)
itemDom.parentNode.parentNode()
itemDom.selectSingleNode('../..')
itemDom.selectNodes(XPath).length
itemDom.selectSingleNode(
String XPath)
itemDom.selectNodes(String XPath)
itemDom.appendChild(Node item)
itemDom.removeChild(Node item)
DOM API or AML string concatenation.
DOM API or AML string concatenation.
DOM API or AML string concatenation.
itemDom.selectNodes(String XPath)
Copyright 2007
Aras Corporation.
All Rights Reserved.
Item.setRelatedItem(
Item item)
Item.getParentItem()
Item.getItemCount()
Item.getItemByIndex(
Number 0..N-1)
Item.getItemsByXPath(
String xpath)
Item.appendItem(Item
item)
Item.removeItem(Item
item)
Item.newOR()
Item.newAND()
Item.newNOT()
Item.removeLogical(
Item item)
Item.getErrorWho()
Item.setErrorWho(
String who)
Item.getErrorSource()
Item.setErrorSource(
String source)
Item.getResult()
Page 88
13 AML Schema
The AML dialect described above follows the following XML Schema. The majority of
this schema defines the standard set of Properties all Items have.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="AML">
<xsd:complexType maxOccurs="unbounded">
<xsd:element name="Item">
<xsd:attribute name="id" type="xsd:ID" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="typeID" type="xsd:IDREF" />
<xsd:attribute name="action" type="xsd:string" />
<xsd:attribute name="order_by" type="xsd:string" />
<xsd:attribute name="select" type="xsd:string" />
<xsd:attribute name="pagesize" type="xsd:integer" />
<xsd:attribute name="page" type="xsd:integer" />
<xsd:attribute name="levels" type="xsd:integer" />
<xsd:attribute name="config_path" type="xsd:string" />
<xsd:attribute name="version" type="xsd:Boolean" />
<xsd:attribute name="serverEvent" type="xsd:Boolean" />
<xsd:element name="id">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="classification">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="512" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="keyed_name">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="128" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="created_on" type="xsd:dateTime" />
<xsd:element name="created_by_id">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="modified_on" type="xsd:dateTime" />
<xsd:element name="modified_by_id">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="current_state">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="state">
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 89
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="locked_by_id">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="is_current">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="major_rev">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="8" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="minor_rev">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="8" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="is_released">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="not_lockable">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="css">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="2147483647" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="generation" type="xsd:int" />
<xsd:element name="new_version">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="config_id">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Relationships"
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 90
Copyright 2007
Aras Corporation.
All Rights Reserved.
Page 91