/**
* Engine Javascript
*/
import {Field} from 'mx:emulator';
const Columns = ['key','description'];
const subfile_data = Object.fromEntries(Columns.map(x => [x, []]));
class CollectJDEFunctionKeys{
constructor(basePage) {
this.collectfunctionKeyMethod();
Page.update();
}
async collectfunctionKeyMethod(){
console.log("Collect Function Keys");
const page = Page.get(); //To get page details
console.log(`page ${page}`);
var screenName = Page.get().name; //To get page screen name
console.log(`screenName ${screenName}`);
//checking condition whether screen name is not Signon
if(screenName != "SIGNON"){
screen.sendKey('F24');
await screen.waitForUpdate();
var currentscreenNameafterF24KeyPress =Page.get().name;
console.log(`currentscreenNameafterF24KeyPress ${currentscreenNameafterF24KeyPress}`);
if(currentscreenNameafterF24KeyPress == "96012"){
console.log(`In 96012 screen`);
const status = screen.fields.status;
console.log(`status ${status}`);
while (status.value.match(/MORE/)) {
console.log(`more`);
this.traverse();
screen.sendKey('Page Down');
await screen.waitForUpdate()
status = screen.fields.status;
}
// Collect the last page
if (status.value.match(/Bottom/)){
console.log(`Bottom last row`);
this.traverse();
screen.sendKey('F3');
await screen.waitForUpdate()
};
}
console.log("Traversed Data", JSON.stringify(subfile_data));
script.structure.Session
}
}
traverse(){
// Traverse all fields and collect values
for (const name of Columns) {
subfile_data[name].push(...screen.fields[name].getLines());
console.log(screen.fields[name].getLines());
}
}
}
const BasePage = Page.get();
var CollectFK = new CollectJDEFunctionKeys(BasePage);
Hi,
I am new to scripting in Engine side javascript.
I have created one engine side javascript, In that I have scripted to collect function keys and also I have stored it in json object. Now I need a solution to display it in page.
Previously We have written in VB script to collect and display it in page using global structure as Variable. Below is the structure we used,
Structure SessionStructure
Dim data As SessionDataStructure
End Structure
Structure SessionDataStructure
Dim FunctionKeys as FunctionKeysStructure
End Structure
Structure FunctionKeysStructure
Dim key() As String
Dim description() As String
End Structure
In Page , we call that gloabl variable to display it @&&session.data.FunctionKeys.description(0)@
below is the screenshot for your refernece.
Thanks.
