Variables and imported Java classes

HCL ZIETrans variables

In HCL ZIETrans, there are two main types of variables: global variables and macro variables. The differences between them are outlined here.

Global variables

Global variables are variables created in HCL ZIETrans Toolkit and used by HCL ZIETrans projects. Global variables are stored outside of the macro script. They are maintained and updated by HCL ZIETrans runtime. There are two types of global variables:

Local
A local global variable is one that is created within an HCL ZIETrans project, and is only visible to the project.
Shared
A shared global variable is one that is visible to and can be used by all the HCL ZIETrans Web applications in an .ear file.

Whether a global variable is considered local or shared depends on whether the shared check box in the GUI is checked when the global variable is created, or whether the value of the shared attribute of a set, prompt, or extract tag is specified as yes or no in the HCL ZIETrans .hma source file.

Macro variables

Unlike global variables, macro variables are used and stored within macros in the HCL ZIETrans .hma source file. The macro editors can be used to create macro variables. To create macro variables using the VME, see Variables and Types tab, and using the AME, see Variables tab. The macro variables are created, stored, and used by the macro engine, and listed in the macro script.

In an HCL ZIETrans macro (.hma) file source using HCL ZIETrans prompts and extracts for global variables, the prompts and extracts appear in the file before the macro script syntax. The macro script, which contains the macro variables, is enclosed by the begin <HAScript> and the end </HAScript> tags.

Introduction to macro variables and imported types

Macro variables help you to add programming intelligence to macros. With a variable you can store a value, save a result, keep a count, save a text string, remember an outcome, or do any number of other programming essentials.

You can create a variable that belongs to any of the standard data types (string, integer, double, boolean, and field).

You can also create a variable that belongs to an imported type representing a Java™ class. You can then create an instance of the class and call a method on the instance. This capability opens the door to the abundant variety of functionality available through Java class libraries, including libraries in the Java Runtime Environment (JRE) libraries, classes or libraries that you implement yourself, or Java classes and libraries from other sources.

Advanced macro format required

Using variables requires that you use the advanced macro format for your macro (see Basic and advanced macro format). Therefore, if you want to add variables to a macro that is in the basic macro format, you must decide whether to convert the macro to the advanced macro format. If you have an old macro in the basic macro format that many users rely on and that works perfectly, you might want to leave the macro as it is.

However, remember that all recorded macros are recorded in the basic macro format. So, if you have recently recorded a macro and are beginning to develop it further, then you might simply not have gotten around to switching to the advanced macro format.

The macro editors address both these situations by popping up a window with the following message when you start to define a variable in a macro that is still in the basic macro format:

Figure 23. Reminder message
You are attempting to use an advanced macro feature. If you choose to continue,
your macro will automatically be converted to advanced macro format. Would you
like to continue?

Click Yes if you are building a macro in which you plan to use variables, or No if you have a macro in the basic macro format that you do not want to convert.

Scope of variables

The scope of every variable is global with respect to the macro in which the variable is created. That is, every variable in a macro is accessible from any macro screen in the macro. All that an action or a descriptor in a macro screen has to do to access the variable is just to use the variable name.

For example, suppose that you have a variable named $intPartsComplete$ that you initialize to 0. You might use the variable in the following ways as the macro proceeds:

  1. ScreenC completes Part 1 of a task and increments $intPartsComplete$ using a Variable update action.
  2. ScreenG completes Part 2 of a task and increments $intPartsComplete$ using a Variable update action.
  3. ScreenM has a Conditional action that tests whether 1 or 2 parts have been completed so far. Depending on the result, the macro expects either ScreenR or ScreenS as the next macro screen to be processed.
  4. ScreenS completes Part 3 of a task and increments $intPartsComplete$ using a Variable update action.

In this example, actions in several different macro screens were able to read from or write to the variable $intPartsComplete$.

Creating a variable

In the Source view, you create a variable using a <create> element. There is a containing element called <vars> that contains all the variables in the macro script, and there is a <create> element for each variable. Figure 24 shows a <vars> element that contains five <create> elements:

Figure 24. Sample <vars> element
<vars>
   <create name="$strAccountName$" type="string" value="" />
   <create name="$intAmount$" type="integer" value="0" />
   <create name="$dblDistance$" type="double" value="0.0" />
   <create name="$boolSignedUp$" type="boolean" value="false" />
   <create name="$fldFunction$" type="field" />
</vars>

In Figure 24, the <vars> element creates one variable from each of the standard data types (string, integer, double, boolean, and field).

You must put all variable creations (<create> elements) inside the <vars> element. The <vars> element itself must appear after the <import> element, if any (see the next section), and before the first macro screen (<screen> element).

Creating an imported type for a Java class

In the Source view, you create an imported type using a <type> element. There is a containing element called <import> that contains all the imported types in the macro script, and there is a <type> element for each imported type. Figure 25 shows an <import> element that declares an imported type, followed by a <vars> element that creates and initializes a variable belonging to the imported type:

Figure 25. Imported type and variable of that type
<import>
   <type class="java.util.Hashtable" name="Hashtable" />
</import>

<vars>
   <create name=$ht$ type="Hashtable" value="$new Hashtable(40)$" />
 </vars>

In the figure above the <import> element contains one <type> element, which has a class attribute (containing the fully qualified class name, java.util.Hashtable) and a name attribute (containing the short name, Hashtable). The <vars> element contains one <create> element, which as usual specifies a name ($ht$), a type (Hashtable), and an initial value (which here is not null but rather is a call to a constructor that returns an instance of the class, $new Hashtable(40)$).

If you are using the source view, you must put all imported types (<type> elements) inside the <import> element. The <import> element itself must appear inside the <HAScript> element (see <HAScript> element) and before the <vars> element.

Common issues

Deploying Java libraries or classes

During macro playback, when the macro runtime processes a call to a Java method, the macro runtime searches all the available Java library files and class files for the class to which the method belongs. The search does not stop until it finds the class.

Deploying a Java library or class consists of placing the library file or class file containing the class in a location where the macro runtime can find it during macro playback. The following Java classes are automatically available for use and do not need to be deployed by you:

All other Java classes containing methods invoked by a macro script must be deployed by you to a location where the macro runtime can find them. Depending on the environment, you can deploy the Java classes as class files or as libraries containing Java classes.

When using Java classes in a WebSphere® Application Server runtime environment (not portal), be aware that the macro runtime is packaged in a Java EE Enterprise Application (.ear) file. If the Java classes are packaged in an HCL ZIETrans Web project, you must update the Web archive (WAR) class loader policy to Single class loader for application to ensure that the macro runtime can access them when the macro runs. If this configuration is not done, ClassNotFoundExceptions will occur when the macro invokes the Java classes. To learn how to configure the class loader policy, see Configuring application class loaders in the documentation for the version of WebSphere Application Server that you are using .

Variable names and type names

The rules for variable names are as follows:

The rules for type names are as follows:

Transferring variables from one macro to another

The PlayMacro action, in which one macro "chains to" another macro (a call without return), allows you to transfer all the variables and their values belonging to the calling macro to the target macro. The target macro has access both to its own variables and to the transferred variables (see PlayMacro action (<playmacro> element)).

Field variables

A field variable is a type of string variable. It holds a string, just as a string variable does, and you can use it in any context in which a string variable is valid.

However, a field variable differs from a string variable in the way in which a string is stored into the field variable. The string that a field variable contains is always a string that the macro runtime reads from a 3270 or 5250 field in the current host terminal. To get the macro runtime to read this string from the 3270 or 5250 field, you have to create a Variable update action that specifies:

  1. The name of the field variable (such as $fldFilename$).
  2. A location string (a string containing a pair of integers separated by a comma, such as '5,11').

When the macro runtime performs the Variable update action it takes the following steps:

  1. Looks in the host terminal at the row and column value specified by the location string.
  2. Finds the 3270 or 5250 field in which the row and column value is located.
  3. Reads the entire contents of the field.
  4. Stores the entire contents of the field as a string into the field variable.

For more information, see Variable update action with a field variable.

Using variables

The macro runtime assigns initial values to variables at the start of the macro playback, before processing any macro screen. The sections that follow describe the usage of those initial values for both standard and imported variable types.

Using variables belonging to a standard type

Using the value that the variable holds

A variable that belongs to a standard type (string, integer, double, boolean) can be used in much the same way as an immediate value of the same type (such as 'Elm Street', 10, 4.6e-2, true):

However, you cannot use a variable in certain contexts. In the AME, you cannot use a variable in the following contexts:

In the source view, you cannot use a variable in the following contexts:

Writing a value into a variable belonging to a standard type

You can write a value into a variable belonging to a standard type in the following ways:

Restrictions

You cannot assign one of the following values to a variable of standard type:

Writing a Java object into a variable of standard type

If you write a Java object into a variable of standard type, then the macro runtime calls the toString() method of the imported type and then attempts to assign the resulting string to the variable.

Using variables belonging to an imported type

Using the value that the variable holds

You can use the value contained in a variable belonging to an imported type in the following ways:

Restrictions

You cannot assign the following types of data to a variable of imported type:

If your macro attempts to assign one of these invalid types of values to a variable of imported type, then the Macro runtime generates a runtime error and halts the macro.

Writing into the variable belonging to an imported type

You can write a value into a variable of imported type in the following ways:

You can assign the following types of values to a variable belonging to an imported type:

Comparing variables of the same imported type

In any conditional expression (for example, in the Condition field of a conditional action) in which you are comparing two variables of the same imported type, you should implement a comparison method (such as equals()) in the underlying class rather than using the variables themselves. For example,

$htUserData.equals($htPortData$)$

If instead, you compare the variables themselves (for example $htUserData$ == $htPortData$), then:

  1. The macro runtime, for each variable, calls the toString() method of the underlying Java class and gets a string result
  2. The macro runtime compares the two string results and gets a boolean result.
  3. The macro runtime sets the result of the condition to the boolean result obtained in step 2.

This will probably not yield the outcome that you expect from comparing the two variables.

Calling Java methods

Where method calls can be used

You can call a method in any context in which the value returned by the method is valid. For example, in an Input action you can set the Row value to the integer value returned by a method, such as:

$importedVar.calculateRow()$

Also, you can use the Perform action to call a method when you do not need the return variable of the method or when the method has no return value (void) (see Perform action (<perform> element)).

Syntax of a method call

To call a method belonging to an imported class, use the same syntax that you would use in Java. However, in addition, you must also enclose a method call in dollar signs ($), just as you would a variable. Examples:

$new FileInputStream('filename')$
$fis.read()$ 

An immediate string value (such as 'Elm Street', or 'myFileName' in the first example above) passed as a parameter to a method must be enclosed in single quotes, as usual (see Advanced macro format rules).

How the macro runtime searches for a called method

When you add a method call (such as $prp.get('Group Name')$) to a macro script, the macro editor does not verify that a called method or constructor exists in the class to which the variable belongs. That check is done by the macro runtime when the call occurs.

The method must be a public method of the underlying Java class.

When the macro runtime searches in the Java class for a method to match the method that you have called, the macro runtime maps macro data types (boolean, integer, string, field, double, imported type) to Java data types as shown in Table 12:

Table 12. How the macro runtime maps macro data types to Java data types
If the method parameter belongs to this macro data type: Then the macro runtime looks for a Java method with a parameter of this Java data type:
boolean boolean
integer int
string String
field String
double double
imported type underlying class of the imported type

The macro runtime searches for a called method as follows:

  1. The macro runtime searches for the class specified in the imported type definition (such as java.util.Properties).
  2. The macro runtime searches in the class for a method with the same method signature (name, number of parameters, and types of parameters) as the called method.
  3. If the search succeeds, then the macro runtime calls the method.
  4. If the search fails, then the macro runtime searches in the class for a method with the same name and number of parameters (disregarding the types of the parameters) as the called method.
    1. If the macro runtime finds such a method, it calls the method with the specified parameters.
    2. If the call returns without an error, the macro runtime assumes that it has called the right method.
    3. If the call returns with an error, the macro runtime searches for another method.
    4. The search continues until all methods with the same name and number of parameters have been tried. If none was successful, then the macro runtime generates a runtime error.

The Macro Utility Libraries (HML libraries)

The Host On-Demand Macro Utility Libraries (HML libraries) are utility libraries that are packaged with the HCL ZIETrans code. You can invoke a method from one of these libraries without:

In fact, you are not allowed to import a class contained in an HML Java library, or to create a variable belonging to an HML class, or to create an instance of an HML object.

The reason is that the macro runtime, during the initializing that goes on when macro playback is started:

The following table shows for each HML variable the variable name and the types of methods in the underlying class.

Table 13. HML variables
HML variable: Description of methods:
$HMLFormatUtil$ Methods for formatting strings.
$HMLPSUtil$ Methods that access the presentation space of the session window.
$HMLSessionUtil$ Methods that return session values.
$HMLSQLUtil$ Methods that return information about the results of the most recent SQLQuery action.

Invoking a method belonging to an HML library

To invoke a method belonging to an HML library, specify the variable name, method name, and input parameters in the usual way:

Figure 26. Example of invoking HML methods
$HMLFormatUtil.numberToString(1.44)$
$HMLPSUtil.getCursorPos()$
$HMLSessionUtil.getHost()$

Variable names beginning with HML are reserved

To prevent confusion between normal variables and HML variables, variable names beginning with HML are reserved. If you try to create a variable beginning with HML, Host On-Demand generates an error message.

$HMLFormatUtil$

The methods invoked with $HMLFormatUtil$ are formatting methods. Table 14 summarizes these methods:

Table 14. Method summary for $HMLFormatUtil$
METHOD SUMMARY: $HMLFormatUtil$
String
numberToString(Object obj)
Converts a number to a string formatted according to the currently configured locale. The input parameter can be of type integer or of type double.
int or double
stringToNumber(String str)
Converts a numeric string in the local format (such as '1111.56', '1,111.56', or '1111,56') to a number. The number returned is either of type integer or of type double, depending on the input string.

Converting numbers to and from the format of the current locale

A locale is a set of formatting conventions associated with a particular national language and geographic area. For example, depending on the locale with which a client workstation is configured, a decimal value such as 1111.22 can be represented with any of the following strings:

'1111.22'
'1,111.22'
'1111,22'

As another example, a negative number such as -78 can be represented as:

'-78'
'78-'

The methods numberToString() and stringToNumber() perform conversions between a number (that is, a variable or immediate value of type integer or type double, such as 1111.22) and its representation in the current locale (a string, such as '1111.22', '1,111.22', or '1111,22').

Method details

numberToString()
public String numberToString(Object obj)

This method converts a number (integer or double) to a string formatted according to the currently configured locale. The input parameter can be of type integer or of type double.

Figure 27. Example for numberToString()
<input value="$HMLFormatUtil.numberToString(1111.44)$"
          row="20" col="16" movecursor="true"
          xlatehostkeys="true" encrypted="false" />
stringToNumber()
public int stringToNumber(String str)
public double stringToNumber(String str)

This method converts a numeric string formatted according to the currently configured locale to a number. The number returned is either of type integer or of type double, depending on the input string.

This method replaces the standalone method $FormatStringToNumber()$, which is deprecated.

Figure 28. Example for stringToNumber()
<value="’1111.33’" />
<extract name="'Extract'" planetype="TEXT_PLANE"
         srow="1" scol="1"
         erow="1" ecol="10" unwrap="false"
         assigntovar="$value$" />
<if condition="$HMLFormatUtil.stringToNumber($value$)$ < 0 "
   ...
</if>

$HMLPSUtil$

The methods invoked with $HMLPSUtil$ affect the presentation space of the session window or return information about the presentation space of the session window. Table 15 summarizes these methods:

Table 15. Method summary for $HMLPSUtil$
METHOD SUMMARY: $HMLPSUtil$
int
convertPosToCol(int pos)
Returns the column number of the specified position in the presentation space.
int
convertPosToRow(int Pos)
Returns the row number of the specified position in the presentation space.
void
enableRoundTrip(boolean flag)
For bidirectional languages, determines whether numerals preceded by bidirectional characters exchange places with the numerals.
int
getCursorCol()
Returns the column number of the text cursor in the presentation space.
int
getCursorPos()
Returns the position of the text cursor in the presentation space.
int
getCursorRow()
Returns the row number of the text cursor in the presentation space.
int
getSize()
Returns the size of the presentation space (number of character positions in the presentation space) .
int
getSizeCols()
Returns the number of columns in the presentation space.
int
getSizeRows()
Returns the number of rows in the presentation space.
String
getString(int pos, int len)
Returns the text string beginning at the specified position in the presentation space and running for the specified length.
int
searchString(String str)
Returns the position in the presentation space of the specified string (0 if the specified string is not found in the presentation space).

Presentation space

The presentation space is a data structure that contains an element for each row and column position in the session window (but not including the last row of the session window, which is used for the Operator Information Area). The size of the presentation space depends on the size of the session window. For example, if the session window has 24 rows and 80 columns, then the size of the presentation space is 24 * 80 = 1920.

The position of the elements in the presentation space corresponds serially to the row and column positions in the session window, reading from left to right, top to bottom. For example, if the session window has 80 rows and 25 columns, then row and column positions are as shown in Figure 29:

Figure 29. Correspondence of row and column location in the presentation space
     Row of    Column of  Corresponds to
     Session   Session    element at this
     Window:   Window:    position in PS:
         1          1             1
         1          2             2
         1          3             3
      ...
         1         80            80
         2          1            81
         2          2            82
         2          3            83
      ...
        24         79          1919
        24         80          1920

Host On-Demand uses the presentation space to store the characters that are to be displayed in the session window. Each element in the presentation space is used to store one character (and information about that character, such as intensity). For example, if the string Message appears at row 1 and column 1 of the session window, then rows and columns correspond to the positions shown in Figure 30:

Figure 30. Layout when 'Message' appears in row 1, column 1
     Row of    Column of  Corresponds    Character
     Session   Session    to element     stored in
     Window:   Window:    at this pos-   this element:
                          ition in PS:
         1          1          1          M
         1          2          2          e
         1          3          3          s
         1          4          4          s
         1          5          5          a
         1          6          6          g
         1          7          7          e

Although you normally will not need to use them, Table 16 shows the formulas for calculating various values. The meanings of the symbols used in these formulas are as follows:

Table 16. Formulas for calculating values related to presentation space
Value: Formula for calculating:
Size of the PS
 NUMROWS * NUMCOLS

    Example:
    24 * 80 = 1920
row
 (pos + NUMCOLS - 1) / NUMCOLS

    Example:
    (81 + 80 - 1) / 80 = 2 
col
 pos - ((row - 1) * NUMCOLS)

    Example:
    1920 - ((24 - 1) * 80) = 80
pos
 ((row - 1) * NUMCOLS) + col

    Example:
    ((24 - 1) * 80) + 1 = 1641

Method details

convertPosToCol()
public int convertPosToCol(int pos)

This method returns the column number associated with the specified position in the presentation space.

Figure 31. Example for convertPosToCol()
<varupdate name="$cursor_col$ value="$HMLPSUtil.convertPosToCol($HMLPSUtil.getCursorPos()$) $" />
convertPosToRow()
public int convertPosToRow(int pos)

This method returns the row number associated with the specified position in the presentation space.

Figure 32. Example for convertPosToRow()
<varupdate name="$cursor_row$" value=$HMLPSUtil.convertPosToRow($HMLPSUtil.getCursorPos()$)$" />
enableRoundTrip()
public void enableRoundTrip(boolean flag)

This method is for bidirectional languages only (Arabic and Hebrew). Assume that A, B, and C are bidirectional characters. Normally, when a string contains a series of bidirectional characters followed by a series of numerals (for example, ABC 123), and the entire string is stored, the Host On-Demand client exchanges the positions of the bidirectional characters and the numerals. For example, normally, if you read the string ABC 123 from the presentation space and store the string into a variable, and then subsequently write the value of the variable back into the presentation space, the Host On-Demand client writes 123 ABC back into the presentation space.

To turn off this technique of forced reversal, call enableRoundTrip() with a value of true. To restore this technique of forced reversal, call enableRoundTrip() with a value of false.

Figure 33. Example for enableRoundTrip()
<perform  value="$HMLPSUtil.enableRoundTrip(true)$" />
getCursorCol()
public int getCursorCol()

This method returns the column location of the text cursor in the presentation space.

Figure 34. Example for getCursorCol()
<input value="$HMLSessionUtil.getHost()$"
          row="$HMLPSUtil.getCursorRow()$"
          col="$HMLPSUtil.getCursorCol()$+2"
          movecursor="true" xlatehostkeys="true"
          encrypted="false" />
getCursorPos()
public int getCursorPos()

This method returns the position of the text cursor in the presentation space.

Figure 35. Example for getCursorPos()
<varupdate name="$cursor_pos$" value="$HMLPSUtil.getCursorPos()$" />
         
getCursorRow()
public int getCursorRow()

This method returns the row location of the text cursor in the presentation space.

Figure 36. Example for getCursorRow()
<input value="$HMLSessionUtil.getHost()$"
          row="$HMLPSUtil.getCursorRow()$"
          col="$HMLPSUtil.getCursorCol()$+2"
          movecursor="true" xlatehostkeys="true"
          encrypted="false" />
getSize()
public int getSize()

This method returns the size of the presentation space, that is, the number of character positions in the presentation space. For example, if the session window has 25 rows and 80 columns, then the size of the presentation space is 24 * 80 = 1920.

Figure 37. Example for getSize()
<varupdate name="$size$" value="HMLPSUtil.getSize()$" />
getSizeCols()
public int getSizeCols()

This method returns the number of columns in the presentation space. The presentation space has the same number of columns as the session window. For example, if the session window has 25 rows and 80 columns, then the number of columns in the presentation space is 80.

Figure 38. Example for getSizeCols()
<varupdate name="$size_cols$" value="$HMLPSUtil.getSizeCols()$" />
getSizeRows()
public int getSizeRows()

This method returns the number of rows in the presentation space. The presentation space has one row less than the session window (because the last line of the session window, which contains the Operator Information Area, is not included in the presentation space). For example, if the session window has 25 rows and 80 columns, then the number of rows in the presentation space is 24.

Figure 39. Example for getSizeRows()
<varupdate name="$size_rows$" value="$HMLPSUtil.getSizeRows()$" />
getString()
public String getString(int pos, int len)

This method returns the text string beginning at the specified position in the presentation space and continuing for the specified number of characters.

Figure 40. Example for getString()
<varupdate name="$text_of_row_18$"
          value="$HMLPSUtil.getString(
                    $HMLPSUtil.getSizeCols()$*17+1,
                    $HMLPSUtil.getSizeCols()$)$" />
searchString()
public int searchString(String str)

This method returns the position in the presentation space of the specified string. This method returns 0 if the string is not found in the presentation space.

Figure 41. Example for searchString()
<varupdate name="$pos_ofIBM$" value="$HMLPSUtil.searchString('IBM')$" />

$HMLSessionUtil$

The methods invoked with $HMLSessionUtil$ return values associated with the session. Table 17 summarizes these methods:

Table 17. Method summary for $HMLSessionUtil$
METHOD SUMMARY: $HMLSessionUtil$
String
getHost()
Returns the text string specified in the Destination Address field of the session configuration.
String
getLabel()
Returns the string specified in the Session Name field of the session configuration
String
getName()
Returns the session instance identifier assigned to the session by the host.

Method details

getHost()
public String getHost()

This method returns the host name or the host address that you typed into the Destination Address field of the Connection section of the session configuration (such as myhost.myloc.mycompany.com or 9.27.63.45).

Figure 42. Example for getHost()
<varupdate name="$host$" value="$HMLSessionUtil.getHost()$" />
getLabel()
public String getLabel()

This method returns the session name that you typed into the Session Name field of the Connection section of the session configuration (a name such as 3270 Display or 5250 Display).

Figure 43. Example for getLabel()
<varupdate name="$label$" value="$HMLSessionUtil.getLabel()$" />
getName()
public String getName()

This method returns the identifying name that the host assigns to the session (such as A , B, or C). When you start a session, the host assigns a name to the session to distinguish it from other instances of the same session that might be started.

Figure 44. Example for getName()
<varupdate name="$name$" value="$HMLSessionUtil.getName()$" />

$HMLSQLUtil$

The methods invoked on $HMLSQLUtil$ return information about the results of the most recent SQLQuery action. Table 18 summarizes these methods:

Table 18. Method summary for $HMLSQLUtil$
METHOD SUMMARY: $HMLSQLUtil$
int
getColumnSize()
Returns the number of columns of data.
String
getDataByIndex()
Returns the entry located at the specified row index and column index.
String
getDataByName()
Returns the entry located at the specified row index and column name (field name).
int
getRowSize()
Returns the number of rows of data.

Format of the stored data

The results of the SQLQuery action are stored as a two-dimensional array that is one column wider and one row taller than the size of the block of data returned. Row 0 is used to store the names of the columns (the field names from the database), and Column 0 is used to store a zero-based index (see Table 19 below). The entry at Row 0, Column 0 contains an empty string. The remainder of the array contains the actual data. All values are strings.

Table 19 shows as an example the results of a query, a 3 x 5 block of data, stored in a 4 x 6 array:

Table 19. Example of two-dimensional array containing results
(empty string) TOPICID EXMPLID DESCRIPT
0 4 18 Create a toolbar with custom buttons.
1 9 54 Attach tables at startup.
2 11 74 Edit Products.
3 11 75 Enter or Edit Products
4 11 76 Find Customers

In the table above, the entry at Row 0, Column 0 contains an empty string. The remainder of Row 0 contains the field names from the database (TOPICID, EXMPLID, DESCRIPT). The remainder of Column 0 contains index numbers for the rows (0, 1, 2, 3, 4). The actual data is contained in the remainder of the array. All values are strings.

Method details

getColumnSize()
public int getColumnSize()

This method returns the actual number of columns of data in the array, including the added Column 0. For example, for the array in Table 19 this method returns 4.

Figure 45. Example for getColumnSize()
<varupdate name="$col_size$" value="$HMLSessionUtil.getColumnSize()$" />
getDataByIndex()
public int getDataByIndex(int row, int column)

This method returns the entry at the specified row and column index. The following list shows the values returned for the data shown in Table 19:

Figure 46. Example for getDataByIndex()
<varupdate name="$data$" value="$HMLSessionUtil.getDataByIndex(3,3)$" />
getDataByName()
public int getDataByName(int row, String fieldName)

This method returns the entry at the specified row and field name. The following list shows the values returned for the data shown in Table 19:

Figure 47. Example for getDataByName()
<varupdate name="$data$" value="$HMLSessionUtil.getDataByName(3,'DESCRIPT')$" />
getRowSize()
public int getRowSize()

This method returns the actual number of rows of data in the array, including the added Row 0. For example, for the array in Table 19 this method returns 6.

Figure 48. Example for getRowSize()
<varupdate name="$row_size$" value="$HMLSessionUtil.getRowSize()$" />

FormatNumberToString() and FormatStringToNumber()

$FormatNumberToString()$ is deprecated in favor of $HMLFormatUtil.numberToString()$. The former has the same input parameters and return type as the latter (see numberToString()).

$FormatStringToNumber()$ is deprecated in favor of $HMLFormatUtil.stringToNumber()$. The former has the same input parameters and return type as the latter (see stringToNumber()).