iModernize - The Profound Logic Software Blog

Handling Multiple Companies and Divisions within Atrium

Posted by Alex Roytman on Oct 15, 2015 3:48:25 AM

Atrium Navigation Modernization for IBM i, AS400, iSeriesAtrium is a browser based menu portal that allows you to reproduce your entire green screen menu and display it as a tree or accordion format. A user can click a menu item which starts a Genie interactive session. Genie then runs a macro which navigates though the green screen menus until it arrives at the target screen. The navigation occurs very quickly, is not visible to the user and is a very effective way to modernize and simplify access to an ERP application running on IBM i.

Recently, we have come across situations where there are multiple companies or divisions within an application. The green screen menus may allow a user to enter a company number or similar which changes the library list, thereby changing the company. A Genie macro is certainly able to detect the company field and populate a company number but there is no built-in method to choose a specific company when running an Atrium menu item. However, this can be accomplished using a little bit of JavaScript code, along with a new Atrium feature that allows you to execute JavaScript code from within a Genie Macro.

Adding a dropdown for company or division

In Profound UI, there is a special IFS directory (/www/profoundui/htdocs/profoundui/userdata/extension/atrium), which Atrium checks when it starts. Any JavaScript files in this directory will be loaded by Atrium. We can add a file (let’s call it company-atrium-extension.js) into this directory with the following sample code. This will add a label and a dropdown with three companies.

Atrium.onload = function() {

var container = document.getElementById("Atrium-addFavButton");
while (container.tagName != "DIV") {
container = container.parentNode;
}

var label = document.createElement("div");
label.style.position = "absolute";
label.style.top = "7px";
label.style.right = "360px";
label.innerHTML = "Company:";
container.appendChild(label);

var dropdown = document.createElement("select");
dropdown.id = "companyNumber";
dropdown.style.position = "absolute";
dropdown.style.top = "5px";
dropdown.style.right = "200px";
dropdown.style.width = "150px";

dropdown.options.add(new Option("Acme Construction", "AC01"));
dropdown.options.add(new Option("Acme Disposal", "AC02"));
dropdown.options.add(new Option("Acme Home Improvements", "AC03"));
dropdown.value = "AC01";

container.appendChild(dropdown);
}

The end result may look as follows:

Company Division in Atrium - IBM i, iSeries, AS400

While the company names and values are hard-coded in this example, it is also possible to load them dynamically by using an AJAX call (see http://www.profoundlogic.com/docs/pages/viewpage.action?pageId=4849957) and Universal Display Files (see http://www.profoundlogic.com/docs/display/PUI/Universal+Display+Files).

Please note, the dropdown box has been assigned the id of “companyNumber” by the JavaScript code.

Passing the company to a Genie Macro

When adding a Genie Macro action, you can now select a new data type when writing a value into a field. By selecting “The result of a JavaScript expression” for the data type, we can specify an expression that will retrieve the company number from the dropdown list and pass it to the macro.

The screenshot below illustrates this capability:

Atrium2

We hope you find this information useful! Try Atrium today at: http://www.profoundlogic.com/products/atrium-menu-framework-for-ibm-i.html. You can learn more about Genie at: http://www.profoundlogic.com/products/genie-web-enablement-tool-for-5250-applications.html

Topics: Tips and Tricks

Subscribe to Blog Updates

....and get The 2019 State of IBM i Modernization survey for FREE!

cover page 2019-1

Recent Posts