I have a Statistic Collector table that contains waiting time for each patient in my model.
After the simulation is finished I want to calculate the average waiting time like this:
double total = Table.query("SELECT AVG(Waiting_time) FROM $1", Table("Patient_info"))[1][1]; double avg = total / n;
but I get this error:
exception: FlexScript exception: Invalid row number: 1 in Table.query() result table. at <no path> c: <no path> i: <no path>
I then tried to clone the result to a table:
Table.query("SELECT AVG(Waiting_time) FROM $1", Table("Patient_info")).cloneTo(Table("Some_table"));
but I only get an empty table with no rows and a single column named avg($1.Waiting_time)
I know that I could use Calculated tables as an alternative, but I'm still curious to why the above isn't possible?