(RDMLX) Online Navigation

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’.
soapagent
Posts: 93
Joined: Mon Jul 16, 2012 6:19 pm

(RDMLX) Online Navigation

Post by soapagent »

I have a table bound to SQL Statement that displays data like

2012 10
2013 11
2013 12

This currently goes to a detail form using

#Com_Owner.Set Property('ENTRY_LIST.ONROWCLICK.OPERATION.TYPE') To('OpenForm')
#Com_Owner.Set Property('ENTRY_LIST.ONROWCLICK.OPERATION.NAME') To(BOSSO002)
#Com_Owner.Set Property('ENTRY_LIST.ONROWCLICK.OPERATION.PRESENTMODE') To('Stack')

However, I need to go to a different form depending on the values within each row as each (10, 11 12) has different format. I can't set values at row level because it is bound.

I thought I might be able to point the click event at a script and let the script decide which form to display but I can't see any way of achieving this.

Any ideas?
Mark_Dale
Posts: 61
Joined: Thu Apr 19, 2012 11:06 am

Re: Online Navigation

Post by Mark_Dale »

A suggested approach is to have multiple sub-forms on your target form (BOSSO002), and to hide all the sub-forms except the appropriate one, based on the row data. This could be done by an ECL script that runs when the target form opens. You can hide a subform by setting its height to 0.

(You can't open different forms from the ECl script because the binding context will be lost - the target of the ECL script would not have access to the row data)
soapagent
Posts: 93
Joined: Mon Jul 16, 2012 6:19 pm

Re: Online Navigation

Post by soapagent »

Mark
This sounds like the kind of thing I'm after.

The question is on entry to BOSSO002 how do I call script that executes before the page is displayed?
Mark_Dale
Posts: 61
Joined: Thu Apr 19, 2012 11:06 am

Re: Online Navigation

Post by Mark_Dale »

I haven't tried it, but wouldn't it be something like:

#Com_Owner.Set_Op_ExecScript Event('/Form.OnLoad') Resource(Myscript.js)
soapagent
Posts: 93
Joined: Mon Jul 16, 2012 6:19 pm

Re: Online Navigation

Post by soapagent »

I created a copy of LREX0325.js called StudentsOnline.js added it the schema. I've added

Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #LRNG_FORM)

Mthroutine Name(HandleRequest) Options(*REDEFINE)

#Com_Owner.Set_Op_ExecScript Event('/Form.OnLoad') Resource(StudentsOnline.js)

#Com_Owner.Using Element('/Form.Fields')

Case Of_Field(#COM_OWNER.RequestACTION)
.
.


I've refreshed the schema and ran this but the Console remains blank (there is a this.console("... statement.

The syntax looks OK according to the documentation but I can't see any evidence that this is executing.
Mark_Dale
Posts: 61
Joined: Thu Apr 19, 2012 11:06 am

Re: Online Navigation

Post by Mark_Dale »

Try this:

Instead of specifying:
#Com_Owner.Set_Op_ExecScript Event('/Form.OnLoad') Resource(LREX0325.js)

try:
#Com_Owner.Set Property('/Form.OnLoad.Operation.Type') To(ExecScript)
#Com_Owner.Set Property('/Form.OnLoad.Operation.Resource') To(LREX0325.js)

(This gets around the longrange lansa replacement of '/Form.OnLoad' with '/RunOperation')
soapagent
Posts: 93
Joined: Mon Jul 16, 2012 6:19 pm

Re: Online Navigation

Post by soapagent »

Cheers, that did the trick.
soapagent
Posts: 93
Joined: Mon Jul 16, 2012 6:19 pm

Re: Online Navigation

Post by soapagent »

Having got into the script I need to access the values passed in to the function. These are available within the offline function using SQL binding from the calling function

#Com_Owner.Set_TextBox Name(STUDYR) Layout_Row(1) Layout_Col(1)
#Com_Owner.Set_Binding Name(STUDYR) Property(VALUE) Bindtotype(FLD) Bindto('STUDYR')

#Com_Owner.Set_Binding Name(BOUND_TABLE) Property(ROWLIST) Bindtotype(SQL) Bindto('SELECT ROWID, STDID, CALYR, STUDYR, CRSID, STDMSI, SCHID, SCHLNM, CRSLNM FROM StudentCourses WHERE STUDYR=&(FLD:StudentEntries.STUDYR)

How do I get access to the FLD.STUDYR value?

this.q_getProperty("Form.Fields.STUDYR.Value");

returns null, I guess because the onload happens before the binding is performed.
tsupartono
Posts: 289
Joined: Wed Apr 18, 2012 10:21 am

Re: Online Navigation

Post by tsupartono »

When an element is bound to a table, you should access the underlying table directly (as opposed to using the 'Value' property of the element).

From ECL, you can use q_sql to do this.

For example, if I want to get the value of field "SURNAME" from the currently selected table row:

Code: Select all

lrexec(

function()
{
     this.q_sql(''SELECT &(FLD:SURNAME) '', ''scalar'');
},

function(result)
{
     this.console("Value of SURNAME in current context = ", result);
}

);
soapagent
Posts: 93
Joined: Mon Jul 16, 2012 6:19 pm

Re: Online Navigation

Post by soapagent »

Thanks, that worked.
Post Reply