ThinkGeo.com    |     Documentation    |     Premium Support

Questions Regarding Version 14.4.0-beta049

Subject: Questions Regarding Version 14.4.0-beta049

Hello,

I have two questions regarding version 14.4.0-beta049:

1. TextStyle
We previously set the TextColumnName property of TextStyle to "[Name1]\n[Name2]" in order to display labels using two fields from a Microsoft SQL Server table.
After upgrading to version 14.4.0-beta049, the labels are no longer displayed.
Through testing, I found that using square brackets causes the issue. If I use only one field name without brackets, it works.
Is this a bug, or do I need to update my code to match new requirements?

2. SqlServerFeatureLayer
We use views from a Microsoft SQL Server database, and some records have NULL values in the geom column.
To display the layer correctly, we have to set the WhereClause like this:
layer.WhereClause = "WHERE geom IS NOT NULL";
Is this behavior expected?

Also regarding the TextStyle:
I consistently get the following error:
DataReader.GetFieldType(59) returned null

Any suggestions are welcome.
Thanks in advance,
Torsten

Hi Torsten,

  1. We found “[” and “]” are both valid characters in column names so we stopped using them for multiple columns combination. Please use TextStyle.TextContent instead which can set to “{ColumnA} \n {ColumnB}”.

  2. it’s not a valid ThinkGeo feature if the geom column is null, as a result it’s fine to add “WHERE geom IS NOT NULL”.

  3. Can you let me know how to recreate the DataReader.GetFieldType(59) returned null error?

Thanks,
Ben

Hallo Ben,
Thanks for the quick response and the explanation.
For the DataReader error: The view contains a field “Name1”

name1

The stacktrace in the DrawCore is

bei System.Data.ProviderBase.SchemaMapping.SetupSchemaWithoutKeyInfo(MissingMappingAction mappingAction, MissingSchemaAction schemaAction, Boolean gettingData, DataColumn parentChapterColumn, Object chapterValue)
   bei System.Data.ProviderBase.SchemaMapping..ctor(DataAdapter adapter, DataSet dataset, DataTable datatable, DataReaderContainer dataReader, Boolean keyInfo, SchemaType schemaType, String sourceTableName, Boolean gettingData, DataColumn parentChapterColumn, Object parentChapterValue)
   bei System.Data.Common.DataAdapter.FillMappingInternal(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 schemaCount, DataColumn parentChapterColumn, Object parentChapterValue)
   bei System.Data.Common.DataAdapter.FillMapping(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 schemaCount, DataColumn parentChapterColumn, Object parentChapterValue)
   bei System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
   bei System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
   bei System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   bei System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
   bei System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
   bei ThinkGeo.Core.SqlServerFeatureSource.GetColumnsCore()
   bei ThinkGeo.Core.FeatureSource.GetColumns()
   bei ThinkGeo.Core.FeatureSource.GetColumnNamesInsideFeatureSource(IEnumerable`1 returningColumnNames)
   bei ThinkGeo.Core.FeatureSource.GetFeaturesInsideBoundingBox(RectangleShape boundingBox, IEnumerable`1 returningColumnNames)
   bei ThinkGeo.Core.FeatureLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)
   bei WmsWmtsDemoApp.SqlServer.MySqlServerLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers) in C:\Code\_Samples\WFS_WMTS\SqlServer\MySqlServerLayer.cs: Zeile21

Thanks Torsten

Hi Torsten,

It seems the 59th column in the SQL view cannot be explicitly cast and evaluates to NULL. Some options for you:

  1. We’ve made some improvements in the latest beta to skip those ‘NULL’ columns, pull the latest beta051 and see if it fixes the issue.
  2. Create a subclass MySqlServerFeatureSource : SqlServerFeatureSource, override GetColumnsCore() method and only return the Columns you need to use in your application. Do sqlServerFeatureLayer.FeatureSource = new MySqlServerFeatureSource() to link it to the layer.
  3. Review how the SqlServer Views are created and make sure there’s no NULL column exists / can be successfully casted in runtime.

Thanks,
Ben