12.2 Automatic Data Apportionment

LANSA supports the automatic apportionment of data. This feature is particularly useful for fields in your HTML form where the data can exceed the 256-character limitation. For example, if you have a field in your HTML form that accepts user feedback or comments, you would require this field to accept more than 256 characters. However, LANSA fields are limited to 256 characters.

LANSA allows you to use a single field in your HTML form, but yet if the data exceeds the field’s length, the data will not be lost.

The technique used by LANSA is to use sibling fields, following the naming convention:

<field name><sequence number>

The name of the sibling fields consists of two parts, the field name and a sequence number. The length of the sibling field name must be 9 characters, with the sequence number part padded with leading zeros.

For example, if your field name is COMMENT. The sibling fields would be COMMENT01, COMMENT02, up to COMMENT99. However, if the field name were COMMT, the sibling fields would be COMMT0001, COMMT0002, up to COMMT9999.

In other words, if the data length you intend to support is large, then the field name should be short, to allow for more sibling fields.

If the sibling fields are used in your application, LANSA will apportion the data and store each part of the divided data in the sibling fields. If the number of fields is too small to hold all of the data, the rest of the data will be lost.

As an example, if you wanted to create a component for the COMMENT field that allows the user to type in as much comments/feedback as he wishes, you can create a textarea component. This component can be created as an input mode Visual Web component.

<RDML CHECKVALUE="YES">

<textarea name="COMMENT" rows="6" cols="75">

<RDML MERGE="COMMENT">

<RDML MERGE="COMMENT01">

<RDML MERGE="COMMENT02">

<RDML MERGE="COMMENT03">

<RDML MERGE="COMMENT04">

<RDML MERGE="COMMENT05">

</textarea>

</RDML>

You will notice that the field is only identified by a single name, COMMENT. However, the data is populated using 6 fields, COMMENT, COMMENT01, COMMENT02, COMMENT03, COMMENT04 and COMMENT05, using the <RDML MERGE> LANSA tag.

When the form is submitted to the Web server, LANSA will handle the apportionment of the data automatically. It determines if the length of the returned data is greater than 256 characters. If the length exceeds 256 characters, it will apportion the data into portions, with each portion split at 256 characters. The first 256 characters is stored in the COMMENT field. The second portion is stored in COMMENT01, the third in COMMENT02, and so on.

If the data length exceeds 1536 characters (256x6), then any data greater than 1536 characters will be lost, unless you have defined other sibling fields in your application, i.e. COMMENT06, etc.

Refer to 12.2.1 Specifying Apportionment Position.