Page 1 of 1

Clicked Column Name of an offline form

Posted: Wed Nov 11, 2015 2:34 am
by billcros
Is there a way to determine the column name that was clicked in the js file the executes as part of an offline form ?

Re: Clicked Column Name of an offline form

Posted: Wed Nov 11, 2015 8:42 am
by MarkDuignan
I think might be how you find out ...............

http://www.longrangemobile.com/docs/lrp ... raises.htm

Note the hierarchy note at the end as it's probably significant here.

This is the RPG documentation - but RDMLX programs and offline forms would access the same property.

Re: Clicked Column Name of an offline form

Posted: Thu Nov 12, 2015 10:37 pm
by billcros
I need to be able to access the information in a .js file that executes as part of the function, the information given only shows how to access the information in RPG or RDML.

Re: Clicked Column Name of an offline form

Posted: Fri Nov 13, 2015 8:32 am
by tsupartono
Hi Bill,
If you are handling the 'OnRowClick' event, unfortunately there is no way to find out which column the user tapped.

Instead, you might want to handle the 'OnClick' event of the column.
In your ExecScript operation, you can pass an argument that indicates which column triggers the execution of the script.

An example below (in pseudocode) assumes that you have a table called "MyTable", and two columns that when clicked will execute a script and pass an argument called "COL" (args.COL). The first column will pass "FirstName", and the second will pass "Surname".

Code: Select all

Using ("Form.Fields")
  Using ("MyTable")

    Using ("Col%1.Content")
        Using ("OnClick.Operation")
           SetProperty ("Type", "ExecScript")
           SetProperty ("Args.COL", "FirstName")
        EndUsing
    EndUsing

    Using ("Col%2.Content")
        Using ("OnClick.Operation")
           SetProperty ("Type", "ExecScript")
           SetProperty ("Args.COL", "Surname")
        EndUsing
    EndUsing

Note: if you use RDMLX, you may want to set the properties using direct access if you find it more convenient. Please see http://www.longrangemobile.com/docs/lan ... inglon.htm

Then in your ECL JavaScript, you can read the argument by referencing "args.COL", like so:

Code: Select all

lrexec (
    function()
    {
        var col = args.COL;
        if (col == "FirstName") . . .
        else if (col == "Surname") . . .
    }, ...
Let us know how you go with this.

Re: Clicked Column Name of an offline form

Posted: Fri Nov 13, 2015 9:42 pm
by billcros
That worked, thanks for your assistance.