Why are tables not appearing in downloaded offline geodatabase?

738
6
10-20-2016 02:03 PM
PaulHaakma
Regular Contributor

Hi all.

I have uploaded a feature layer into AGOL, which includes a couple of point feature classes plus some related tables.

In an app, I then download and generate an offline geodatabase. But when I examine the generated offline geodatabase, none of the tables have been created.

Is there some reason for this, something extra that needs to be set, or is it some sort of bug?

Cheers,

-Paul

0 Kudos
6 Replies
nakulmanocha
Esri Regular Contributor

Can you please share your service and the sample code to test this issue? I wanna make sure you are not initializing the GenerateGeodatabaseParameters after setting the layerids.

-Nakul

0 Kudos
GarethWalters3
New Contributor III

Hi Paul, 

Haven't written anything up here for a while, hope you're doing well.

If you haven't already figured this out you need to adjust your layerIds property in the GeodatabaseParameters.  I was luck in the app that I built that we could hard code, but if you wanted to reuse it, you are going to have interrogate the service to find all layers and tables.  

generateGeodatabaseParameters.initialize(serviceInfoTask.featureServiceInfo);
console.log ("before:", JSON.stringify(gdbComponents.generateGeodatabaseParameters.json, undefined, 2));
generateGeodatabaseParameters.layerIds = [0,1,2,3];
generateGeodatabaseParameters.returnAttachments = true;
console.log ("after:", JSON.stringify(generateGeodatabaseParameters.json, undefined, 2));
geodatabaseSyncTask.generateGeodatabase(generateGeodatabaseParameters, gdbPath + "/" + gdbName);

Cheers,

Gareth

					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
0 Kudos
PaulHaakma
Regular Contributor

Thanks Gareth

I had set up a test service and Nakul had tested and replied to me just earlier today with a similar response to your comment above. It seems that the key is to add the line to specifically detail the layer ids required.

I haven't had a chance to test yet, but since Nakul was able to successfully test using my feature service I'm expecting it should work.

Thanks for your reply!

Cheers,

-Paul

0 Kudos
PaulHaakma
Regular Contributor

Hi Gareth and Nakul

Just following up on this thread....

Yes, it appears that if you omit to specify the layerids then it excludes tables by default and only downloads spatial feature classes. As indicated, to get the tables, you have to specify all the layer ids.

I'm not sure if this is by design for any reason? If there is no specific reason for tables to be excluded by default, it would be my suggestion that this default behaviour should be modified to include ALL tables and fc's if nothing is specified.

Would be interested to hear if there was any reasoning behind the SDK excluding them?

Cheers,

-Paul

0 Kudos
nakulmanocha
Esri Regular Contributor

Yes, this is a Runtime feature (not AppStudio specific) and by design. If you don't specify layerids it downloads all the features from all the layers which are intersecting with the current Extent (basically a spatial query). Hence  tables (with no geometries) won't get downloaded by default. Also there is a reason why the layerid property has been provided. Because sometimes there might be 100 layers but you don't to perform sync on all the layers. Hence no need to download all the data.

I hope this helps.

Nakul

PaulHaakma
Regular Contributor

Hi Nakul

So I now have the tables appearing in the offline downloaded runtime geodatabase, but I've just realized that there is no data in them. I double checked, and there is data in the table online (this one I'm testing is hosted in agol). 

Is there something else that needs to be set in order for it to actually download table data? Since it doesn't have a spatial component/extent, do I have to set a query somehow? I simply want it to download the whole table and all it's data - the table contains lookup data to use in various ways within an app.

Cheers,

-Paul

0 Kudos