Page 1 of 1

GetList (library program to handle lists)

Posted: Tue Aug 03, 2010 2:05 pm
by EViews Gareth
This thread is about the GetList library. This library asks the end-user for a string list. The user can enter a number of different things:
  • A manual list, e.g.:
    "hello world"
    in which case the subroutine just returns the entered list.
  • The name of a table object in the workfile, in which case the subroutine will return a list containing the entries in the first column of the table, up until the first empty row
  • The name of a svector object in the workfile, in which case the subroutine will return a list containing the entries in the svector
  • The name of a text file (txt) on disk, in which case the subroutine will return a list containing the first "column" of the text file, where columns are delimited by tabs.
  • The name of a csv file on disk, in which case the subroutine will return a list containing the first "column" of the csv file, where columns are delimited by commas.
  • The name of an Excel file (either .xls or .xlsx), in which case the subroutine will return a list containing the entries in the first column (A)


As an example, the attached Excel file can be converted to a string variable with the following code (where you enter the path/name of the Excel file in the dialog that pops up):

Code: Select all


include getlist.prg
create u 1

%test = ""
call getlistdlg(%test, "Enter the name of a table object, an SVector object, a text file or an Excel file, or just enter a list")
statusline {%test}
string aa
aa = %test
show aa