Select to view content in your preferred language

Potential Bug When Filtering Non-Spatial Table With Non-Spatial Table Parent

221
4
09-18-2024 12:50 PM
NathanMeade
Emerging Contributor
The "setWhereClause()" for GenerateLayerOption doesn't work for non-spatial tables if they have a non-spatial table parent, unless the non-spatial parent table also has a where clause set.
 
See the code and comments below:
 
if (layerIdInfosMap.containsKey(generateLayerOption.getLayerId())) {
if (wasGenerated) {
if (wasFiltered) {
generateLayerOption.setQueryOption(GenerateLayerOption.QueryOption.USE_FILTER);
generateLayerOption.setWhereClause(featureLayerInfo.getWhereClause());
} else {
generateLayerOption.setQueryOption(GenerateLayerOption.QueryOption.ALL);
}
} else {
generateLayerOption.setQueryOption(GenerateLayerOption.QueryOption.NONE);
}
} else {
if (wasGenerated) {
if (wasFiltered) {
generateLayerOption.setUseGeometry(false);
generateLayerOption.setQueryOption(GenerateLayerOption.QueryOption.USE_FILTER);
generateLayerOption.setWhereClause(featureLayerInfo.getWhereClause());
} else {
// The following code is a workaround for what we believe is a bug with the ArcGIS Android SDK:
generateLayerOption.setUseGeometry(false);
generateLayerOption.setQueryOption(GenerateLayerOption.QueryOption.USE_FILTER);
generateLayerOption.setWhereClause("OBJECTID > -1");
// This workaround should still get all of the features for this table.
// The assumption being made right now is that each
// ArcGIS Feature Service table has to have the OBJECTID Field.
// This workaround addresses an issue where non-spatial tables with a
// non-spatial parent relationship cannot be filtered unless a real where clause
// is provided to the parent table as well.
//
// The actual call should be:
// generateLayerOption.setQueryOption(GenerateLayerOption.QueryOption.ALL);
}
} else {
generateLayerOption.setQueryOption(GenerateLayerOption.QueryOption.NONE);
}
}

 

0 Kudos
4 Replies
GuntherHeppner
Esri Contributor

@NathanMeade - have you tried to use GenerateLayerOption.QueryOption.NONE in combination with 
GenerateLayerOption.setIncludeRelated(true)? See the doc of setIncludeRelated which indicates that features/rows in this layer are included that are related to other layers/tables in the generated geodatabase. 

 

generateLayerOption.setUseGeometry(false);
generateLayerOption.setQueryOption(GenerateLayerOption.QueryOption.NONE);
generateLayerOption.setIncludeRelated(true);
0 Kudos
NathanMeade
Emerging Contributor

@GuntherHeppner What I am trying to do has nothing to do with relationships. I am just reporting that I am seeing this issue when there are specific kinds of relationships. Unrelated, I have done some testing with GenerateLayerOption.QueryOption.NONE in combination with 
GenerateLayerOption.setIncludeRelated(true) but that was when I was seeing how relationships worked with the SDK. I'm not trying to do any of that here.

 

I'm assuming what I am observing is a bug then? Is this something that could be fixed in an SDK update? Also, is there a way to receive ESRI SDK support other than through this community website? This community site is helpful but it can be easier to have a miscommunication and also hoping for something that would be faster than an average turnaround time of about a week.

0 Kudos
NathanMeade
Emerging Contributor

@GuntherHeppner @DiveshGoyal  @RamaChintapalli Just making sure that this hasn't fallen through the cracks. Is this a current bug in the SDK? Should I go another route for escalating this issue (like not using this ESRI Community website)?

0 Kudos
GuntherHeppner
Esri Contributor

@NathanMeade to determine if this is a bug we will need more information. Please could you submit this issue with Esri Support, ideally providing an app that reproduces the issue. Thanks.

0 Kudos