Page 1 of 1

New Atrium Tab from RPG

Posted: Sat Dec 17, 2016 1:40 pm
by devinst
Is there a way to open a new Atrium tab when calling a Rich Display program from a Rich Display program? I know the API exist for JS but not sure how to call it from RPG, if it is even possible.

Re: New Atrium Tab from RPG

Posted: Tue Dec 20, 2016 9:52 am
by Scott Klement
Since Atrium runs in the browser, you need to call the API from the browser (i.e. from your screen.)

Starting a new Atrium tab will start a whole new job on IBM i... so it is very different from a CALL command in RPG. (More akin to a SBMJOB, I guess, except that its interactive of course.) If you wanted to do it from your RPG logic, one way would be to EXFMT a format, have that format launch the new Atrium tab, and once the tab is open, have the JavaScript press enter or click a button (pui.click() API) on the original format to send control back to RPG.

Re: New Atrium Tab from RPG

Posted: Tue Dec 20, 2016 12:23 pm
by devinst
Thank you Scott.!!
I did think of doing it that way but was not immediately able to figure out a work around for the parameters that need to be sent. I have not used the parameter option in Atrium as of yet so I will look into that.
Thanks again for your help.!!

Re: New Atrium Tab from RPG

Posted: Tue Dec 20, 2016 1:25 pm
by Scott Klement
Assuming that you plan to use the Atrium.launchItem() API, there is a callback that runs when the tab has opened.
http://www.profoundlogic.com/docs/pages ... Id=7864724

So the idea is that when this callback has run, you know the tab has opened, and then you can use pui.click() to return control back to your RPG program.

Off the top of my head, the code might look like this:
<pre>
Atrium.launchItem(1234, true, function(success) {
if (success === true){
pui.click();
}
});
</pre>

Though, perhaps you want to remove the "if success" logic, so that control goes back to the RPG even if the tab couldn't be opened (for some unexpected reason)? Food for thought, I guess.

Re: New Atrium Tab from RPG

Posted: Tue Dec 20, 2016 5:00 pm
by devinst
Sounds perfect. Thanks again Scott.!!