Unable to create table for 'leftTableSource' / 'rightTableSource' dynamic dataLayer with 'id': -1.

10-10-2017 02:27 PM
Occasional Contributor III

I am struggling with trying to use a Map Service that is created by Geoprocessing Service for it output to join to a table in another service.

My map service created with routing results has a stops layer and the map service supports dynamiclayers.   Another map service has a dynamic workspace with dynamiclayers enabled.    I am trying to join from the map service with the Route Stops to the Map Service with the Workspace.

I cannot add a dynamic workspace to the Geoprocessing Service map service in ArcCatalog or Manager so I am wondering if what I am attempting to do is even possible.    The documentation on doing this is not very informative.

When trying to create my dynamiclayer I get the

Unable to create table for 'leftTableSource' / 'rightTableSource' dynamic dataLayer with 'id': -1. error   message.

Below is how I am trying to create my dynamiclayer in ArcGIS JavaScript and what is being passed to ArcGIS Server.

Thanks for any assistance.    I am at a dead end.


function addJoin(evt){
                     //define the layer's data source from a table  
         var rightTableSource = new LayerDataSource(); 
         rightTableSource.dataSource = new TableDataSource({ 
         workspaceId: "FireInspectWorkspaceID", 
         dataSourceName: "FireInspect.dbo.viewMapScheduledInspections" 
        //point to the joined Table related to specific FeatureLayer ID 
        var leftTableSource = new LayerMapSource({ 
             mapLayerId: 1 
         //create a layerDataSource to storage on the fly "join" data 
         var joinDataSource = new JoinDataSource({ 
             joinType: "left-outer-join", 
             leftTableKey: "Name", 
             rightTableKey: "FireInspect.dbo.viewMapScheduledInspections.ID_STRING", 
             leftTableSource: leftTableSource, 
             rightTableSource: rightTableSource 
         //query the feature layer with layerDataSource and list out all data in grid  
         var layerDataSource = new LayerDataSource(); 
         layerDataSource.dataSource = joinDataSource; 
               joinFeatureLayer = new FeatureLayer(gpResultLayer.url + "/dynamicLayer", { 
         mode: FeatureLayer.MODE_ONDEMAND, 
         outFields: ["*"], 
         source: layerDataSource, 
         id: "datalayer" 
               on(joinFeatureLayer, "load", function(evt)
                    var query = new Query(); 
                   query.where = "1=1";                
                   query.outFields = ["*"]; 
          joinFeatureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW, function(results){
0 Kudos
1 Reply
New Contributor III

@MeleKoneya Did you figure it out?

0 Kudos