The Program to User Round Trip
The dataflow that carries field and indicator values from the program to the user involves four buckets:
- RPG Program Variables
DataSet
- Web Control properties
- HTML elements
When going from the program to the browser, the dataflow steps are:
- Busines Logic affects RPG Program Variables
- Write Record copies the variables to the
DataSet
OnCopyDisplayFileToBrowser
copies the DataSet values to the Web Control- Render method generates the HTML stream
On the way back, from browser to program, the steps are:
- Browser sends input values to the server, which get copied to the Web Controls
OnCopyBrowserToDisplayFile
copies the values to the DataSet- The DataSet values are copied to the RPG program variables when the RPG program READs
If your application must manipulate the data in the DisplayFile code behind, it
can utilize the values when they are in either the DataSet or in the Web Control properties. Typically
this is done by overriding the OnCopyxxx
methods. The ASNA.Monarch.WebDspf.Page
makes available its
DataSet via a property conveniently called DataSet
, it also provides a set of methods to facilitate
the manipulation of the values in the DataSet. The DataSet values and the methods can be used
after the *Base.OnLoad
has executed.
Indicator values have additional considerations:
Each record format holds two sets of indicators (100 each): "Option" and "Response" indicators.
The "Option" indicators are used by the RPG program to affect the initial state of fields in the record format. These are used when the record is Written (sent to the Browser). Note that ExFmt command implies a Write).
The "Response" indicators indicate to the RPG program, the state of fields in which the user responded by using the active records while the Browser page was presented and the response was submitted to the server. These are used (affecting the RPG indicators) when active record formats are Read (through various RPG/AVR commands, such as coming back from ExFmt, ReadC, et c.)
Dataflow of Indicators in DataTable
- RPG Program Write-Record operation sets indicators in DataTable with the values of the indicators of the RPG program
- Code Behind
SetIndicator()
can override DataTable option Indicators
- On
*Base.OnCopyDspFileToBrowser
uses the indicators as option indicators to affect the behavior of the DdsControls
- On
*Base.OnCopyBrowserToDspFile
sets the indicators as resulting indicators with values of1-0-x
depending if the indicator was used by the DdsControls of the Record
- Code Behind
SetIndicator()
can override DataTable respone Indicators (with1-0-x
values)
- RPG Program Read-Record operation Sets the indicators of the RPG Program with the
'1'
and'0'
in the DataTable, 'x' values are ignored
Related Methods
These methods can impact field and indicator values after the *Base.OnLoad
has executed, for instance in:
OnCopyDspFileToBrowser
OnCopyBrowsertoDspFile
And occasionally in:
- OnLoad
Method that Tests for Active Format
Bool IsFormatActive(FormatName)
Methods that Get Data
DataTable GetDataTable(FormatName)
DataRow GetDataRow(FormatName)
DataRow GetSubfileDataRow(FormatName, RRN)
Object GetFieldValue(FormatName, FieldName)
Object GetSubfileFieldValue(FormatName, FieldName, RRN)
Methods that Set Field Values
SetFieldValue(FormatName, FieldName, Object newValue)
SetSubfileFieldValue(FormatName, FieldName, RRN, Object newValue)
Methods that Get Indicators
Char = GetOptionIndicator(FormatName, indicator (1->99))
Char [100] = GetOptionIndicators(FormatName)
Char = GetResponseIndicator(FormatName, indicator (1->99))
Char [100] = GetResponseIndicators(FormatName)
Char = GetSubfileOptionIndicator(FormatName, RRN(1->), indicator (1->99))
Char [100]= GetSubfileOptionIndicators(FormatName, RRN (1->))
Char = GetSubfileResponseIndicator(FormatName, RRN(1->), indicator (1->99))
Char [100]= GetSubfileResponseIndicators(FormatName, RRN (1->))
Methods that Set Indicators
The Setting indicator functions will rise an exception if they are called between *Base.OnCopyDspFileToBrowser
and *Base.OnCopyBrowserToDspFile
is irrelevant.
SetOptionIndicator(string FormatName, indicator (1->99), char newValue01)
SetResponseIndicator(string FormatName, indicator (1->99), char newValue01X)
SetSubfileOptionIndicator(FormatName, RRN(1->), indicator (1->99), char newValue01)
SetSubfileResponseIndicator(FormatName, RRN(1->), indicator (1->99), char newValue01X)