AnsweredAssumed Answered

Create Replica Question

Question asked by KCI_Geosolutions on Nov 25, 2014
Latest reply on Apr 24, 2015 by kor_

When creating a replica through the REST API, is it possible to return all records from a table, but without bringing all of the related records with it? A simplified example of my issue is like this:


I have three tables: BUILDING, BUILDING_INSPECTION, and INSPECTOR. BUILDING_INSPECTION has a 1:M relationship with BUILDING and INSPECTOR has a M:1 relationship with BUILDING_INSPECTION.


I want to create a replica of the data based on an envelope that contains a subset of the BUILDING records. Obviously, I only want the BUILDING_INSPECTION records related to the BUILDING records in the specified envelope, so the queryOptions for these layers are like this:



     Query Option: useFilter

     useGeometry: true

     includeRelated: (ignored since queryOption is useFilter)



     Query Option: none

     useGeometry: false

     includeRelated: true


This works fine except, I want to bring down all of the INSPECTOR records also. Therefore, the queryOptions for INSPECTOR need to look like this:



     Query Option: all

     useGeometry: false

     includeRelated: (ignored since queryOption is all)


Now, I get all of the INSPECTOR records in the replica, but also unintentionally get all of the BUILDING_INSPECTION records that are related to the INSPECTOR records (which ends up being all of the inspections). Furthermore, since the additional BUILDING_INSPECTION records are related to other BUILDING records, I end up unintentionally retrieving all BUILDING records that have an inspection. The issue is that I can't change the query option of BUILDING_INSPECTION to not include related records, because I need the BUILDING_INSPECTION  records related to the BUILDING records in the specified envelope.


The way that I understand the createReplica REST endpoint is that there is no way to choose a specific relationship to acknowledge while ignoring all others. Is there something that I am missing here?