Version 4.2.6 for Mainframes
 —  Natural for Ajax  —

XCIDATADEF - Data Definition

With an XCIDATADEF control, you can define data structures that are exchanged between a page and its adapter, but which are not visually represented on the page. Examples are Natural control variables, which can be assigned to controls on a page after they have been defined in an XCIDATADEF control. They are not visually represented on the page, but can be evaluated by the application to control the modification status of the page and its controls.

The XCIDATADEF control allows the definition of scalar variables, structures, arrays, structures of arrays and arrays of structures. When an adapter is generated from a page that contains one or more XCIDATADEF controls, corresponding Natural data structures are generated into the parameter data area of the adapter.

The following topics are covered below:


Example

The following example shows several field controls and a grid control. It uses XCIDATADEF controls to define control variables and assigns these in various ways to the fields and grid elements of the page.

Example

The XML layout definition is:

<?xml version="1.0" encoding="UTF-8"?>
<natpage hotkeys="13;onEnter" natsource="CTRCV-A" natsinglebyte="true" natcv="cv-page"
  xmlns:njx="http://www.softwareag.com/njx/njxMapConverter">
    <titlebar name="Control Variable Samples">
    </titlebar>
    <pagebody takefullheight="true">
        <rowarea name="Simple Field With Control Variable">
            <itr>
                <label name="First Name:" width="80">
                </label>
                <field valueprop="firstname" width="200" njx:natcv="cv-firstname">
                </field>
                <hdist width="50">
                </hdist>
            </itr>
            <itr>
                <label name="Last Name:" width="80">
                </label>
                <field valueprop="lastname" width="200" njx:natcv="cv-lastname">
                </field>
            </itr>
        </rowarea>
        <rowarea name="Grid With Control Variables">
            <rowtablearea2 griddataprop="persons" rowcount="4" width="100%">
                <tr>
                    <gridcolheader width="30" propref="selected">
                    </gridcolheader>
                    <gridcolheader name="ID" width="25%" propref="id">
                    </gridcolheader>
                    <gridcolheader name="Last Name" width="40%" propref="last">
                    </gridcolheader>
                    <gridcolheader name="First Name" width="35%" propref="first">
                    </gridcolheader>
                </tr>
                <repeat>
                    <str valueprop="selected">
                        <selector valueprop="selected" singleselect="true">
                        </selector>
                        <field valueprop="id" width="25%" noborder="true" 
                          transparentbackground="true">
                        </field>
                        <field valueprop="last" width="40%" noborder="true"
                          transparentbackground="true" njx:natcv="persons(*).cv-last">
                        </field>
                        <xcidatadef dataprop="cv-last" datatype="C">
                        </xcidatadef>
                        <field valueprop="first" width="35%" noborder="true"
                          transparentbackground="true" njx:natcv="cv-first(*)">
                        </field>
                    </str>
                </repeat>
            </rowtablearea2>
        </rowarea>
        <rowarea name="Description" height="100%">
            <itr takefullwidth="true" height="100%">
                <subpage valueprop="infopagename" height="100%" width="100%">
                </subpage>
            </itr>
        </rowarea>
    </pagebody>
    <statusbar withdistance="false">
    </statusbar>
    <xcidatadef dataprop="cv-page" datatype="C">
    </xcidatadef>
    <xcidatadef dataprop="cv-firstname" datatype="C">
    </xcidatadef>
    <xcidatadef dataprop="cv-lastname" datatype="C">
    </xcidatadef>
    <xcidatadef dataprop="cv-first" datatype="C" array="true">
    </xcidatadef>
</natpage>

The above example shows various ways in which control variables can be defined and assigned to controls:

The corresponding adapter code looks as follows:

DEFINE DATA PARAMETER
/*( PARAMETER
1 CV-FIRST (C/1:*)
1 CV-FIRSTNAME (C)
1 CV-LASTNAME (C)
1 CV-PAGE (C)
1 FIRSTNAME (A) DYNAMIC
1 INFOPAGENAME (A) DYNAMIC
1 LASTNAME (A) DYNAMIC
1 PERSONS (1:*)
2 CV-LAST (C)
2 FIRST (A) DYNAMIC
2 ID (A) DYNAMIC
2 LAST (A) DYNAMIC
2 SELECTED (L)
/*) END-PARAMETER
END-DEFINE
...
/*( PROCESS PAGE
PROCESS PAGE (CV=CV-PAGE) U'/njxdemos/ctrlcontrolvar' WITH
PARAMETERS
 NAME U'firstname'
  VALUE FIRSTNAME (CV=CV-FIRSTNAME)
 NAME U'infopagename'
  VALUE INFOPAGENAME
 NAME U'lastname'
  VALUE LASTNAME (CV=CV-LASTNAME)
 NAME U'persons(*).first'
  VALUE PERSONS.FIRST(*) (CV=CV-FIRST(*))
 NAME U'persons(*).id'
  VALUE PERSONS.ID(*)
 NAME U'persons(*).last'
  VALUE PERSONS.LAST(*) (CV=PERSONS.CV-LAST(*))
 NAME U'persons(*).selected'
  VALUE PERSONS.SELECTED(*) (EM='false'/'true')
END-PARAMETERS
/*) END-PROCESS
...

The example code is contained in the library SYSEXNJX as program CTRCV-P.

Top of page

Properties

Basic
dataprop

The XCIDATADEF control allows to create data structures for the processing side that are created in addition to data structures that are created by the normal controls. The DATAPROP represents the name of the data element that provides the content of the control.

Optional  
datatype

Data type of the data element. One of the list of valid values. Using the reserved word "type" you can nest multiple XCIDATADEF structures.

Optional

type

xs:string

xs:int

xs:float

xs:decimal

xs:double

xs:date

xs:dateTime

xs:time

xs:byte

xs:short

------------------------

N n.n

P n.n

string n

C

array

If set to true, the XCIDATADEF will be an array.

Optional

true

false

Top of page