AnsweredAssumed Answered

Using join data source as source for feature layer

Question asked by manghiec on May 26, 2015
Latest reply on May 26, 2015 by manghiec

Does anyone have an example of using a join data source as the source for a feature layer?  I've successfully done this in the Flex API, but am having difficulty with the JS equivalent.  Here's a bit of my code

 

var rightTableSource = new LayerDataSource();
  rightTableSource.dataSource = new TableDataSource({
  workspaceId: "[workspaceid]",
  dataSourceName: "[tablename]"
});
var leftTableSource = new LayerMapSource({
  mapLayerId: 0
});
var dataSource = new JoinDataSource({
  joinType: "left-outer-join",
  leftTableKey: "Name",
  rightTableKey: "Name",
  leftTableSource: leftTableSource,
  rightTableSource: rightTableSource
});

var featureLayer = new FeatureLayer("[urltomapservice]/dynamicLayer", {
  id: "featureLayer",
  mode: FeatureLayer.MODE_ONDEMAND,
  source: dataSource,
  outFields: ["*"]
});

 

 

I don't get an error, so I assume it's working but the joined fields are not recognized.  I know this is possible with a dynamic map service layer.  Any ideas are much appreciated.  Thanks!

Outcomes