[RPG/RDMLX]Retrieve Device name

Please do not use to report errors- use your regional help desk.
Please mark posts as being for RPG or RDMLX (LANSA) developer.
To subscribe by email, display this forum, scroll to the end and select ‘Subscribe Forum’.
jasonzhou
Posts: 74
Joined: Tue Jan 10, 2017 11:26 pm

Re: [RPG/RDMLX]Retrieve Device name

Post by jasonzhou » Mon Jul 16, 2018 7:22 pm

The following demo code may work for you:)

JavaScript code:

Code: Select all

function getDeviceName(){
    LONGRANGE.Form.runOperation({
        operation: {
            type: "execScript",
            Resource: "LRECL_GetDevName.js"
        }        
    });
}

function onLongRangeFormDataSet(userData){
    alert(userData["DEVICENAME"]);    
}
ECL code (LRECL_GetDevName.js)

Code: Select all

lrexec(            
    function()
    {
        this.q_getSystemValue("DEVICE-NAME");
    },
    
    function(result)
    {
        this.q_setProperty("form.fields.MyWebView.Data.DEVICENAME", JSON.stringify(result,null,4));                    
    }
)

Post Reply