diff --git a/server/AyaNova/biz/WidgetBiz.cs b/server/AyaNova/biz/WidgetBiz.cs index 7b7e97bd..26df7fcd 100644 --- a/server/AyaNova/biz/WidgetBiz.cs +++ b/server/AyaNova/biz/WidgetBiz.cs @@ -468,9 +468,8 @@ namespace AyaNova.Biz //RETURN OBJECTS - //todo: need exact rowcount so can set up array on each row - //need to know which index of each row is going to need the id of the next row - + //get the return row object count (number of items in each return row) + int returnRowCount = AyaObjectFields.Count(); List> rows = new List>(); long totalRecordCount = 0; @@ -484,10 +483,21 @@ namespace AyaNova.Biz { while (dr.Read()) { - object[] row = new object[dr.FieldCount]; - dr.GetValues(row); + List row = new List(returnRowCount); + + //Iterate object fields, build return row list as required //INSERT INTO THE RETURN ROWS LIST - items.Add(row); + foreach (AyaObjectFieldDefinition f in AyaObjectFields) + { + AyaFieldData d = new AyaFieldData(); + d.v = dr.GetValue(dr.GetOrdinal(f.SqlDisplayColumnName)); + if (f.SqlIdColumnName != null) + { + d.Id = dr.GetInt64(dr.GetOrdinal(f.SqlIdColumnName)); + } + } + + rows.Add(row); } }