Passing Lists of Strings to Statistica Visual Basic Functions
In some Statistica Visual Basic functions, it is necessary to pass collections (lists) of strings, (e.g., a list of case names for a plot, names of entry/edit fields in a list box, etc.). In these cases you must use delimited text strings (i.e., text separated by a tab or the pipe character "|"). Some examples of such strings are:
Names$ = "Anna|Carolyn|Diane|Francis"
or
'The first parameter is a list of delimited strings InputBox("First Name:|LastName:","Enter names","Jane|Doe")
The following program shows how to make such a delimited string of text from the names of all variables in the current data file:
'Retrieve that active spreadsheet Dim s As Spreadsheet Set s = ActiveDataSet Dim VariableNames As String Dim VarNumber As Integer 'Get the number of variables in the spreadsheet VarNumber = s.Variables.Count 'loop from the first to last variable in the 'spreadsheet. For each loop, add the next variable 'name to the growing string (delimited by a pipe symbol). For i = 1 To VarNumber
VariableNames = VariableNames + "|" + s.VariableName(i)
Next i 'display the final string MsgBox VariableNames
The individual entries within the delimited string can be retrieved by using the function GetDelimitedString (see Retrieving Lists of Strings in Statistica Visual Basic). For general information about strings, see How to Use Strings in Statistica Visual Basic.