It may be easier to use the XResultSet commands to build a string array:
#include "sbasic_include.sbas"
var key as int
var loop as int
var str as string
var nn as string
// Retrieve all of the records where "First" is not blank
key = @XResultSetSearch("Customers.db", "Customers", SEARCH_MODE_AND, SEARCH_SYNTAX_QA, "!First=..")
XResultSetSort(key, "Last:1") // Sort the record using the last name field
nn = @XResultSetTotal(key)
for loop = 1 to nn
XResultSetCurrentPosition(key, loop)
// Concatenate the "First Name" fields into a string array
str = str + @XResultSetValue(key, "First")
if(loop < nn)
{
str = str + ";"
}
next
XResultSetClose(key)
writeln(str)
Once you have "str" (the newly constructed string array), you can use that to populate the combo box.
You may also be able to do it with the string array produced by @XLookupSourceListAll. After you get your string array, change the string array separator from the default semi-colon to the new-line character and call @SortStringArray, which will sort on the first element. Accessing the string array will then give you the element pairs. If you re-access that, with string array separator set back to semi-colon, you can derive either the first or second element and build a new string array using just that element.
#include "sbasic_include.sbas"
var aa as string
var ab as string
var ac as string
var ad as string
var loop as int
var str as string
var nn as string
aa = @XLookupSourceListAll(@fn, "..", "First", "Last;First")
SetStringArraySeparator(@chr(10))
ab = @SortStringArray(aa, 0)
nn = @CountStringArray(ab)
writeln(nn)
for loop = 1 to nn
SetStringArraySeparator(@chr(10))
ac = @AccessStringArray(ab, loop)
SetStringArraySeparator(";")
ad = @AccessStringArray(ac, 2)
str = str + ad
if(loop < nn)
{
str = str + ";"
}
next
writeln(str)
Here again, the "str" variable would be used to populate the combo box.