$lastmember

$lastmember

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

$lastmember

Returns the number of members in a result set.

Syntax

$lastmember(setname)

Parameters

setnameA character string or an expression that evaluates to a character string, being the name of a result set.

Return Value

Number with no decimal places.

Comments

$lastmember returns the (numerical) position of the last member in the specified result set (in effect telling you how many members the set contains). To explicitly specify the current set, use “CurrentSet”, including the quotation marks, as the function is expecting a character string, and CurrentSet is a reserved word.

To ensure against unexpected results, choose set names carefully. At run time, the software distinguishes sets only by their names, even if they are permanent set names created in different application directories.

If, for example, you produce a set called Set1 in directory PersonnelData, and later you produce another set called Set1 in directory TestData, the second version of Set1 replaces the first version. Function $lastmember works on only the most recent version of the set.

Example

To display the number of members in Set1, enter

output ($lastmember("Set1"))
25 % Displays the number of members in Set1.
procedure ProcessSet ()
   if $lastmember("EmpSet") = 0
      return
   endif
   ...more commands...
endprocedure

If a procedure processes a set created elsewhere, it is not necessary to pass the size of the set as a parameter; $lastmember can be used instead.

See Also

$currentmember

$SetCount

About Functional Expressions

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_CAEnglish