Is dataSourceProxy returning bad data? (field types, aliases, supportSelection)

2700
3
12-03-2015 02:21 PM
HoriaTudosie
Occasional Contributor II

Both dataSourceExpired(dataSource, ...) and getDataSourceProxies() (with a bug fix!) returns a dataSource that do not resembles the layer:

  1. expected type domains-code returns actually "esriFieldTypeSmallInteger" (and the f.attributes[<field name>] returns an integer,)
  2. aliases of fields return the name of the field instead of real alias defined in the layer,
  3. supportsSelection of the dataSource returns false instead the value configured, and so selectFeaturesByObjectIds() does not work!

Is it something I do wrong?

How can I fix all those issues?

Tags (1)
0 Kudos
3 Replies
TifPun
by
Occasional Contributor II

Hi Horia,

For #1 (get Int value for fields with coded value domains): The value that you receive is probably the domain code. You need to translate it into the domain name. You should be able to find out the domain information from dataSourceProxy.fields[IndexOfTheFieldYouWant].domain, and that will give you a domain object to look up for the info for the parsing.

For #2 (field name instead of field alias is retruned), do you have some code snippet that you can share?

For #3 (selectFeaturesByObjectIds doesn't work) I will investigate to see if there is a bug preventing selectFeaturesByObjectIds from working correctly.

Please note that the supportsSelection property is read only property, could you check if your widget is consuming a selection data source? I just tried the supportsSelection property (not the selectFeaturesByObjectIds method) and it is returning the correct value to me.

HoriaTudosie
Occasional Contributor II

#1 - was correct: while the type of the field was still 'esriFieldTypeSmallInteger,' I was also a Domain object coming with this field.

(Not sure why the dataSource cannot do the translation by itself, though...)

#2 - no, I do not have a code - I'm trying it in the console. While the popup show the alias configured in the popup of the layer in MapView, in the debug console I see the alias and the field name having the same value. (Maybe the alias have to be configured somethere else, not in the popup, but then that setting would be redundant!)

#3 - while the widget is also aware of a selection dataSource, I'm not quite sure what it is: does not work for the query, so - I thought that the supportSelection of the primary DS should be true (as configured in the layer with MapView) and SelectFeaturesByIds should allow me to show my selection on the map.

In fact, my issue is larger: how can I use from the widget code the actions present in the configuration of the widget as Select, highlight, zoom- or pan-to when I click on a sector of my chart? (I have my Ids, I could have a list of features as well)

I cannot find any documentation or example (an example will do!)

0 Kudos
HoriaTudosie
Occasional Contributor II

Well, I've just found out that the alias configured in the popup is not the same with the one stored in the service!

(Why would be that?!

Now how can I eliminate the redondancy without working on the service, since it is not mine?!

I mean, is it a way to read the popup Alias and do the translation myself?

(Of course that I could hard-code the alias, but this is worse than having a redondancy!)

)

0 Kudos