Skip to main content

Posts

Automatically adjust vertical page breaks in EXCEL

Merge cells is a very useful function in EXCEL, but sometimes, we would find merged area is split while we want to print. Obviously, it is necessary to adjust print area and is very simple. But, what if there are many pages? It will be a tiring work! Let do something with VBA. Below code shows how to automatically adjust vertical page breaks. Dim longBreaks As Long longBreaks = Me.HPageBreaks.Count 'Get total breaks 'Reset all breaks location Call Me.ResetAllPageBreaks Dim i As Long Dim objBreakCell As Range For i = 1 To longBreaks Set objBreakCell = Me.HPageBreaks.Item(i).Location If objBreakCell.MergeCells Then 'If the break is in merged area, set the first cell of area to new page break Call Me.HPageBreaks.Add(objBreakCell.MergeArea.Cells(1)) End If Next

Strip backslashes in PHP

Returned things from webpage request may contain lots of backslashes due to JavaScript and JSON may need to escape some characters. That is inconvenient if we want to handle these results such as do regular expression in PHP; therefore, just use function "stripslashes" to strip all backslashes which are used for escaping characters. $stripped_string = stripslashes($input_string) References: PHP: stripslashes - Manual

Find Item Where Used by AML in Aras Innovator

In Aras Innovator, we could execute command "Where Used" to check where the item is used like below picture. And for programming, AML provides an action "getItemWhereUsed" to do this. <AML> <Item type=" Item Type " id=" Item Id " action="getItemWhereUsed" /> </AML> Results will be contained in tag "relatedItems", just use XPath to retrieve.

Item Window Layout in Aras Innovator

Every time open an item in tab view mode will append an iframe object (hereinafter referred to as window) to body. At the same time, window will be assigned an unique id which consists of opening time and item's id for identifying. Window layout is defined as below picture. If there are many relationship tabs, they will be stored in "iframesCollection" inside relationships window and indexed by RelationshipType's ID. For example, the ID of "Part BOM" is "159C6D88795B4A86864420863466F728"; therefore, the "BOM" tab could be accessed by below code. window.relationships.iframesCollection['159C6D88795B4A86864420863466F728']

Open particular item with system link in Aras Innovator

We know that everything in Aras Innovator is an item. In order to freely use, particular item could be automatically opened after user login. The main entry of Aras Innovator is "Innovator.aspx", so the system link looks like below: http:// Server Name / Web Alias /Client/X-salt=std_11.0.0.6549-X/scripts/Innovator.aspx The field of query string is "StartItem", and its value consists of ItemType, colon, and item's id. Innovator.aspx?StartItem= ItemType : Item's id Below picture shows a scenario to open a "Part" whose id is "0298334919634D35B718E06DE19642C0". Suppose user doesn't login yet, login page will display while enter a link. After user login, that Part item will open automatically. If user already login, there will be an existing session in browser's window used for first login. So, user will get below message, and the item will be opened in that window.