I am working on a JavaScrip app using https://developers.arcgis.com/javascript/jsapi/joindatasource.html
The purpose of this app is to show the polygon features from Table A ( it's a map service layer ) that matches records in Table B ( non spatial table).
The source for this map service and table are both in a FGDB which is also a dynamic workspace. I am able to join the results and see the features in my map but it is returning all the features in the join from table A. Following is a sample request:
.../MapServer/export?dynamicLayers=[{"id":0,"source":{"type":"dataLayer","dataSource":{"type":"joinTable","leftTableSource":{"type":"mapLayer","mapLayerId":0},"rightTableSource":{"type":"dataLayer","dataSource":{"type":"table","workspaceId":"TestWorkSpace","dataSourceName":"_test_bc512580_3dbf_11e4_813c_005056802617"}},"leftTableKey":"ID","rightTableKey":"ID","joinType":"esriLeftInnerJoin"}},"drawingInfo":{"renderer":{"type":"simple","symbol":{"color":[128,0,128,102],"outline":{"color":[128,0,128,255],"width":1.5,"type":"esriSLS","style":"esriSLSSolid"},"type":"esriSFS","style":"esriSFSNull"}}},"minScale":0,"maxScale":0}]&dpi=96&transparent=true&format=png8&layers=show:0&bbox=-10181538.954185508,4115378.1803393513,-9790181.369365595,4279259.16898269&bboxSR=102100&imageSR=102100&size=1280,536&f=image
I am using left-inner-join as JoinType which has been translated to esriLeftInnerJoin. I was assuming that it should return only the matching records.
Am I doing something wrong or is it a bug ?
Hi Mahtab,
I wonder have you converted JoinDataSource into a layerDataSource?
And use query function to query the layerDataSource that add a
LayerSource
> source to FeatureLayer? Please check this API reference:FeatureLayer | API Reference | ArcGIS API for JavaScript
Then you can define the query.where as well as query.outFields to set the rule of the return data
Also, this is a good answer that you should check:
Hi Yue,
Thanks for your response. My implementation is similar to the one that you have shared.
I got it all working except for the issue in using the JoinType which I choose as dataSource.joinType = "left-inner-join";
I will clarify it with an example:
Let's say my feature layer ( A ) has 100 records and table (B) has 5 records. So in this case I was assuming to get the joined result to return only 5 features instead I got 100 records. So as I work around I added a definition query to exclude where rightTableJoinKey is null.
To me it appears to be a bug.
Thanks,
Mahtab
did you find any other solutions ?