SqlByList$

Returns the bylist for a COMPUTE row.

Syntax

SqlByList$ ( sqlconn%, computeid%, column% )

where

sqlconn%
Is a SQL Server connection. The value of sqlconn% is returned by SqlOpen%.
computeid%
Is the COMPUTE clause. A SELECT statement can have multiple COMPUTE clauses, which can have varying numbers of aggregate operators and aggregate targets. The computeid% is returned by SqlNextRow% or SqlGetRow%.
column%
Is the number of the column. The first column is number 1.

Returns

A binary string of column positions for the bylist in the SELECT statement of the current SQL commands.

Remarks

A COMPUTE clause in a SELECT statement can contain the keyword BY, followed by a list of columns. This list, known as the bylist, divides the results of the COMPUTE clause into subgroups based on changing values in the specified columns. The COMPUTE clause's row aggregate is applied to each subgroup, generating a COMPUTE clause row for each subgroup.

The number of columns is equal to the length of the binary string and can be determined by calling LEN( ) with the returned string. Each character is a binary value representing the position of a column in the bylist.

Call SqlByList$ after SqlResults% returns SUCCEED.

Example

The following program fragment shows how to convert a binary value to an integer to get the number of a column position:

ByList$ = SqlByList$(Sqlconn%, ComputeID%)
DIM ByListNumber(LEN(ByList$)) as Integer
FOR x% = 1 to LEN(ByList$)
   ByListNumber(x%) = ASC(MID$(ByList$,x%,1))
NEXT x%

See Also

SqlAData$, SqlADLen&, SqlAltLen%, SqlAltType%, SqlColName$, SqlGetRow%, SqlNextRow%, SqlResults%