Community
I've been trying to read OD definitions and displaying it's contents (C++, Map SDK 2012). So far it works just fine, however getting default values of a column has proven to be a pain. Apparently, if column value isn't actully set, DefaultValue() returns the value of a previous column:
Column0: 'SomeValue'
Column1: ''
Calling DefaultValue() returns SomeValue in both cases, when it obviously shoudn't. Also, IsValid() returns true in both cases and the standard _adeattachdata command displays fields correctly. I'm guessing it's an API bug, as there's not a whole lot of room for mistakes here, but anything's possible.
Relevant code:
AcMapODTable * table; // fetch the table pointer AcMapODTableDefinition t_def(table->Definition()); for(int i = 0; i < t_def.Count(); ++i) { AcMapODColumnDefinition c_def; t_def.GetColumn(c_def, i); if(!c_def.IsValid()) { acutPrintf(_T("ERROR: invalid column definition.\n")); continue; } AcMapValue val(c_def.DefaultValue()); switch(val.Type()) { case AcMap::kCharacter: acutPrintf(_T("%s\n"), static_cast<const ACHAR *>(val)); break; case AcMap::kInteger: acutPrintf(_T("%i\n"), static_cast<int>(val)); break; case AcMap::kPoint: { AcGePoint3d & p(static_cast<AcGePoint3d>(val)); acutPrintf(_T("%lf,%lf,%lf\n"), p.x, p.y, p.z); } break; case AcMap::kReal: acutPrintf(_T("%lf\n"), static_cast<double>(val)); break; default: acutPrintf(_T("ERROR: unknown type.\n")); break; } }