Skip to main content

Posts

Showing posts from June, 2018

Trigger Sequence of Promotion Events in Aras Innovator

There are several Server Event could trigger Method during item promotion: ItemType: OnBeforePromote, OnAfterPromote; Life Cycle: Transition Pre, Transition Post. Trigger sequence of above events is shown in below figure: It's important to note that "Transition Post" cannot rollback while exception throws because item promotion is finished after "OnAfterPromote" That means even if throwing exception, the life cycle will still stay at promoted state. Please note, all above events will not be triggered when "OnPromote" event exists (due to this will overwrite original system process).

Fundamentals of Relationship Operation with Aras Innovator API

Basic knowledge of operating an item object can refer to " Fundamentals of Item Operation with Aras Innovator API ". This article will introduce operation for relationships with JavaScript. Assume Part "A0001" need to be created, the code will be: var inno = aras.IomInnovator; var itm = inno.newItem('Part', 'add'); itm.setProperty('item_number','A0001'); And the built AML Node seems like below: <Item isNew="1" isTemp="1" type="Part" action="add" id="052C2E5D160645E9835BAA74AE732265"> <item_number>A0001</item_number> </Item> Create Relationship Assume Part "A0002" need to be created, and it is the child of "A0001". For another words, "A0002" is Related Item of "Part BOM" Relationship. Syntax var relItm = inno.newItem('Part','add'); relItm.setProperty('item_number','A0002

Fundamentals of Item Operation with Aras Innovator API

Aras Innovator API (Innovator Object Model; IOM) provides simple way to build and submit query request with AML. This article will introduce some common methods. Get Innovator Instance No matter develop server side or client side code, IOM provides same members to call. The only difference is the way to get Innovator instance. Syntax of VB .NET and JavaScript show as below: VB. NET Dim objInno As Innovator = Me.getInnovator() JavaScript var inno = aras.IomInnovator; ※Due to the syntax of IOM in VB .NET and JavaScript are similar, the following examples will only enumerate with JavaScript. Create Item Mainly use the method "newItem". Syntax var itm = inno.newItem('Part', 'get'); Built AML <Item isNew="1" isTemp="1" type="Part" action="get"/> Handle Attribute Related methods are "setAttribute" and "getAttribute". Set Syntax itm.setAttribute('select', 'id

Conditional Operator in VBA/VB .NET

For most of C-like programming languages, conditional (ternary) operator is more concise than If statement. And it is also available in VBA and VB .NET. VBA Conditional Operator The function "IIF" exists since VB6, syntax seems like below: Dim i As Integer Dim s As String i = 1 s = IIf(i > 0, "Greater than zero", "Zero or less than zero") Debug.Print (s) 'Greater than zero i = -1 s = IIf(i > 0, "Greater than zero", "Zero or less than zero") Debug.Print (s) 'Zero or less than zero It is convenient but need to notice that IIF will always evaluate all arguments. See below example: Dim i As Integer i = IIf(True, 1 + 1, 1*1) 'This is OK i = IIf(True, 1 + 1, 1 / 0) 'This will throw exception due to division by zero VB .NET Conditional Operator To improve IIF problem, there is IF operator in VB .NET. Dim i As Integer = 1 Dim s As String = If(i > 0, "Greater than zero", "Zero or less t