Gets simple statistics from ZenTable

Everything OAD-related that won't fit in the other categories: share general aspects of macro programming and discuss the OAD environment
Post Reply
user-6033
Posts: 89
Joined: Thu Jan 01, 1970 1:00 am

Gets simple statistics from ZenTable

Post by user-6033 »

Hi,

Simple statistics like sum, stDev, var, avg, max, min and count can be easily extracted from the tables by adding one extra column for each statistical parameteter of interest and then use the ZenTable.Columns[index].Expression method, see example below. The new column will contain the same aggregated value on each row. Since this procedure needs to be repeated for each feature columnName it can end up with rather messy large tables. It would then be better to create a child table for each feature column where the child contains the statistical parameters of interest, which now also only will occupy one row. However, for that one needs to go to System.Data and use the DataRelation class, create the relation and add it to dataset.tables, which in turn contains the added parent table table and child table. Is there a way to cast the ZenTable to a DataTable, since the dataset.tables.add does not accept ZenTable type?


#myZenTable contains a column with ColumnName "area"
myZenTable.Columns.Add(“average area”)
avgareainx = myZenTable.Columns.indexof("average area")
myZenTable.Columns[avgareainx].Expression = “Avg(area)”

#Each row in column "average area" will now contain the average value of all area values column will now contains

Kind regards
Fredrik Olsson
Post Reply