Share via


FormDataSource.getFirst Method

Retrieves the first record in a data set.

Syntax

public Common getFirst([int mark, boolean fetchAhead])

Run On

Client

Parameters

  • mark
    Type: int
    An integer that determines whether the first record should be returned, or whether the first record that is marked with a particular value should be returned; optional.
  • fetchAhead
    Type: boolean
    A Boolean value; optional. The default value is true.

Return Value

Type: Common Table
The first record in the data set.

Remarks

If the mark parameter is not 0 (zero), the first record that is marked with the specified value is returned, and subsequent calls to the FormDataSource.getNext method return marked records.

If the fetchAhead parameter is set to false, only cached records are returned. If it is set to true, additional records are found and added to the cache, but the operation can become very time-consuming when it is performed on a large record set.

When records in a grid are multiselected, the records are marked with the value 1.

The following examples illustrate how to retrieve a marked or unmarked record: // Get first recordformDataSource.getFirst();// Get first record marked with 2formDataSource.getFirst(2); // Get first cached record marked with 1formDataSource.getFirst(1, false);

Examples

The following example determines whether two records are selected in a form.

boolean twoMarked() 
{ 
    SysVersionControlTmpItem tmpitem  = this.getFirst(1); 
  
    if (!tmpitem) 
    { 
        return false; 
    } 
    tmpitem = this.getNext(); 
  
    if (!tmpitem) 
    { 
        return false; 
    } 
    tmpitem = this.getNext(); 
  
    if (!tmpitem) 
    { 
        return true; 
    } 
    return false; 
}

See Also

FormDataSource Class

FormDataSource.getNext Method