Related Feature on no spatial table

1573
7
01-25-2018 06:57 AM
LionelGOUBET
New Contributor II

Hi,

I created a mmpk with spatial tables and no spatial tables.

I have a spatial which have a relation with a spatial table and a relation with a no spatial table.

I use SDK 100.2.0.

When I use that on a feature, I don't see the relation with the table no spatial while I see the relation with a spatial table.

ListenableFuture<List<RelatedFeatureQueryResult>> listListenableFuture = featureTable.queryRelatedFeaturesAsync(feature);
listListenableFuture.addDoneListener(() -> {

    List<RelatedFeatureQueryResult> relatedFeatureQueryResults = null;

    try {
        relatedFeatureQueryResults = listListenableFuture.get();
        Log.i(TAG, "RESULT : " + relatedFeatureQueryResults.size());
        for (RelatedFeatureQueryResult relatedQueryResult : relatedFeatureQueryResults){
            String relationName = relatedQueryResult.getRelationshipInfo().getName();
            Log.i(TAG, relationName);

            String tableName = relatedQueryResult.getRelatedTable().getTableName();
            List<Field> fields = relatedQueryResult.getRelatedTable().getFields();
        
            ...
        }

Do you have a idea ?

Thanks

0 Kudos
7 Replies
RamaChintapalli
Esri Contributor

HI Lionel,

The relationships between spatial and non-spatial tables within an  MMPK should work. Can you check if all your related spatial tables and non-spatial tables are added to map ?

Note: Getting related tables for a layer or table on the map returns only those tables on the map. Similarly related queries require both origin and destination table/layer to be present on the map.

http://developersdev.arcgis.com/android/latest/guide/relate-features.htm 

Thanks

Rama

0 Kudos
LionelGOUBET
New Contributor II

Hi Rama,

Thanks for your help ...

I create a new map with a new data.

I re-created the related tables and generate my mmpk

but this time i do not have any relation it's worse ...

I don't understand

FeatureLayer l = (FeatureLayer) lyer;
ArcGISFeatureTable featureTable = (ArcGISFeatureTable) l.getFeatureTable();
List<ArcGISFeatureTable> relatedTables = featureTable.getRelatedTables();
relatedTables.size(); // equal 0 !!!


What's the problem ?
Is it a option to export mmpk ?

do I have to load all layers and tables before use them ?

Thanks

0 Kudos
RamaChintapalli
Esri Contributor

Lionel,

The origin FeatureTable on which you are performing related query operations should be in LOADED state. You can check it using `featureTable.getLoadStatus() `

If you have set the map from MobileMapPackage to MapView, that should have LOADED all the layers and tables in the map. If you are working without a MapView then you may have to explicitly load the origin table on which you want to perform related query operations

You can also view the metadata of RelationshipInfo's by calling `ArcGISFeatureTable.getLayerInfo.getRelationshipInfos()` just to make sure the relationships do exist in the MMPK

If it is still returning empty related tables, then we may have to check the data and the relationship details in ArcGISDesktop where the mmpk is generated.

-Rama

0 Kudos
LionelGOUBET
New Contributor II

OK thanks,

I'm going to try ...

Also, I imported a mxd in Arcgis PRO .... perhaps it's a problem

I 'm going created all since Arcgis PRO with my local geodatabase

Thanks

0 Kudos
LionelGOUBET
New Contributor II

So I load my package, map, tables and spatial tables (STATUS = LOADED)

but when I use my function

List<RelationshipInfo> relationshipInfos = featureTable.getLayerInfo().getRelationshipInfos();
int size = relationshipInfos.size();// equal 0 !!

I don't understand

I verify my aprx and the relate work when I see a formview in a map in ArcgisPRO 2.0.0

I generate my mmpk which a zip, if I unzip , i show a file geodatabase which is a sqlite database... how verify the relation in the database ? apparently GDB_ItemRelationsShips ...

Thanks for your help

- Lionel

0 Kudos
RamaChintapalli
Esri Contributor

You can check the ItemInfo column in `GDB_ServiceItems` table for your origin table. The JSON present there should have relationships details

-Rama

0 Kudos
LionelGOUBET
New Contributor II

Ok I'm confused ... I found my error

I created a relate in my map not in my geodatabase ! it's a relation ship

Here a link : https://community.esri.com/groups/esri-training/blog/2009/02/26/relates-vs-relationship-classes 

Thanks Rami

But this response had not been sent, I'm going to see....

0 Kudos