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);
}
}