Data Table To Table Box

This week’s Friday Function is a utility that allows me to display the contents of a table in a window.

table to display box

Here is the code used to create the above output:

dt = Open("$SAMPLE_DATA/Big");
content = H List Box(
		Y( :weight ),
		X( :height ),
		Fit Line,
	Outline Box("Data", <<Outline Close Orientation("Vertical"),
		Data Table To Table Box(dt)
New Window("My Analysis",content);

And here is the definition of the function Data Table To Table Box:

Data Table To Table Box = Function({dt},{Default Local},
	tb = Table Box();
	For (i=1,i<=NCols(dt),i++,
		col = Column(dt,i);
		colName = col << Get Name;
		lstValues = col << Get Values;
		type = col << Get Data Type;
		If (type=="Character",
			tb << Append(
				String Col Box(colName,lstValues)
			tb << Append(
				Number Col Box(colName,lstValues)


Leave a Reply

Your email address will not be published.