Class break render in QueryTableDataSource

214
1
02-08-2020 03:42 AM
StefanoAngarano1
New Contributor

Hi everyone, 

we are using API 4.14 and we are trying join a layer published on the server with a large table on SQL, using QueryTableDataSource and MapImageLayer

Once created the MapImageLayer we try to create a class breaks renderer on a field joined from the SQL table. 

The join looks like this: 

{"source":{"dataSource":{"leftTableSource":{"mapLayerId":0,"type":"mapLayer"},"rightTableSource":{"dataSource":{"workspaceId":"test_DB","query":"SELECT SUM(FIELD_1) FIELD_1, FIELD_2 FROM TABLE WHERE QUERY GROUP BY FIELD_2 ","oidFields":" FIELD_2 ","type":"queryTable"},"type":"dataLayer"},"leftTableKey":"FIELD_3","rightTableKey":"FIELD_2","joinType":"esriLeftOuterJoin","type":"joinTable"},"type":"dataLayer"}}

The fields returned from the SQL table looks like this: sde.testDB.%0827c0da_57d2_4f98_8bc6_cb02da63a56c.FIELD_NAME

 

So when we apply the class break renderer the classification definition looks like this: 

{"type":"classBreaksDef","breakCount":5,"classificationField":"sde.testDB.%0827c0da_57d2_4f98_8bc6_cb02da63a56c.FIELD_1","classificationMethod":"esriClassifyQuantile"}

It works fine until many queries are executed at the same time. In that case it throws the following error: Unable to find 'classificationField'.

 

We noticed that if we try to create this renderer from the REST endpoint deleting the first part of the field name (sde.testDB.%0827c0da_57d2_4f98_8bc6_cb02da63a56c)   also if we try several times the query never fails. 

In this way the classification definition would look like this: 

 {"type":"classBreaksDef","breakCount":5,"classificationField":"FIELD_1","classificationMethod":"esriClassifyQuantile"}

But from Javascript you can't omit that part, otherwise it will throw the following error

  1. name"color-class-breaks-renderer:invalid-parameters"
  2. message"Unknown fields: FIELD_1. You can only use fields defined in the layer schema"

Has anyone ever tried this flow?

I think that if from the Javascript code we could get rid of that prefix from the field name it would work perfectly fine, as it works on the REST side. 

Anyone has any suggestion?

Thanks

Stefano

0 Kudos
1 Reply
TanuHoque
Esri Regular Contributor

Hi Stefano,

It seems like you are hitting a server side bug.

Having said that, it looks like you can still achieve this a bit (might be better in some sense) different approach.

Please see the blog post here: Dynamic Spatiotemporal Exploratory Analysis with Aggregated Results Using Time Series Data in ArcGIS 

Please let me know if you find this new approach is not going to help you much.

Thanks.

Tanu