} // method private IEnumerable <Field> GetConnectedFieldValues(IEnumerable <RelatedColumn> relatedColumns) { foreach (var r in relatedColumns) { StringBuilder sb = new StringBuilder(r.Connection); sb.Append("%%"); sb.Append(r.Category); sb.Append("%%"); sb.Append(r.Field); Field retval = new Field() { Name = sb.ToString(), Label = r.Delimiter, // abused the field for something else. Very dirty trick!!! }; try { // If the Category and Item parameters are both blank, // then Commence uses the item from the most recent AddItem/AddSharedItem command, // MarkActiveItem or ViewMarkItem REQUEST. // In this case, it is MarkActiveItem, which is what we want int conItems = _db.GetConnectedItemCount(string.Empty, string.Empty, r.Connection, r.Category); // we are going to return connected data. // but only if there is a single connected item // we could retrieve all connected data, // but that could potentially take too long switch (conItems) { case 0: retval.Value = "(none)"; break; case 1: retval.Value = _db.GetConnectedItemField(string.Empty, string.Empty, r.Connection, r.Category, r.Field); break; default: retval.Value = "(more)"; break; } } catch { } // swallow all errors yield return(retval); } }