Sub Dialogs - Setting Variables

Started by Dave T., December 24, 2013, 02:29:23 AM

Previous topic - Next topic

Dave T.

Hi,

I've been playing with the new Sub Dialog feature of 2.50 and trying to work out the best way to return variables that are entered in an external sub dialog.

In the example attached the dialog 'subdialog.dialog3' is called to input 'field3', now there is no way that I can find to return a variable (ie like in a call to a function). One way I though of in the 'after input' of the subdialog call the function 'setField3' passing the variable which is then assign to the modular record.

Am I missing something or is there a smarter way to do this ?

Cheers

Dave



Reuben B.

Hi Dave,

In your sub-dialog, define a modular variable and make it PUBLIC so that it is visible outside the 4gl, and use that variable in your 4gl statement e.g.

Code (genero) Select
PUBLIC DEFINE field3 CHAR(10)
...
INPUT BY NAME field3



As it is public you can reference that variable from your main-dialog.4gl

Code (genero) Select
IMPORT FGL sub_dialog
...
LET m_inputRecord.field3 = sub_dialog.field3


Reuben
Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero

Dave T.

That's awesome, it keeps getting better :-)

Thanks