Greetings. I'm performing a join query against 2 feature classes. The QueryDef.SubFields property includes only 1 geometry field. I then use GeoDatabase.OpenQueryTable() to get the table. I'm trying to retrieve the field values from the rows of the result set. Calling row.GetOriginalValue(index) throws an exception that states "The method or operation is not implemented." Attaching source code.
I've also tried an alternate approach calling GeoDatabase.Evaluate(query_def) to get the RowCursor. That approach does not throw an exception, but the call to row.GetOriginalValue(index) always returns null.
What is the correct way to retrieve field values from the results of a query with join?
Solved! Go to Solution.
Hi Michael,
The GetOriginalValue method is used while editing to get the pre-edit value of the field. You cannot edit a QueryDef, so this concept doesn't apply.
You can just use the Item property. Since this is the default indexer on the Row class, you would change your provided code snippet to look like this:
foreach (var field in fields) {
if (field.FieldType == FieldType.Geometry) continue;
// This works
object val = row[field.Name];
// This works too
int index = row.FindField(field.Name);
object val = row[index];
}
I hope this helps,
--Rich
Hi Michael,
The GetOriginalValue method is used while editing to get the pre-edit value of the field. You cannot edit a QueryDef, so this concept doesn't apply.
You can just use the Item property. Since this is the default indexer on the Row class, you would change your provided code snippet to look like this:
foreach (var field in fields) {
if (field.FieldType == FieldType.Geometry) continue;
// This works
object val = row[field.Name];
// This works too
int index = row.FindField(field.Name);
object val = row[index];
}
I hope this helps,
--Rich
Hi Rich,
It certainly did help. Thanks for the quick reply!
Mike