offlinemaptask - taking tables offline and setting attribute queries

918
6
09-11-2019 09:08 PM
by Anonymous User
Not applicable

Hi.

I'm using AppStudio (v4.0, so runtime v100.6), and trying to take a web map offline using OfflineMapTask.

In the web map there are two plain tables (i.e. non-spatial tables). Neither of these have direct database relationships defined with any other spatial layer.

Even though the tables exist in the web map, they never seem to appear in the offline data at all. In the web map I have tried having no definition expression and also manually setting one. GenerateOfflineMapParameters object has a property called "definitionExpressionFilterEnabled" which is true by default, plus one called "destinationTableRowFilter" which I tried setting to Enums.DestinationTableRowFilterAll (0)     but that didn't seem to make any difference either.

So I can't seem to get the table offline at all. But, further to that, I want to be able to define an attribute query on them before I take them offline. For one table, I want ALL records to be taken offline, but for the other table I want the user in the app to type in a particular identifier, and then set a query on that table so only records where an id field matches that id be taken offline.

In the old 10.2.6 runtime, I could achieve this, using GeodatabaseSyncTask.generateGeodatabase(...) which took as a parameter a GenerateGeodatabaseParameters object which had a "layerQueries" property which was a list of objects of which one property was a where clause. I can't seem to find the equivalent functionality in v100.x, although obviously the platform supports the concept.

Any suggestions on the right workflow? Or does anyone know of any samples that already show this workflow?

Thanks,

-Paul

0 Kudos
6 Replies
LukeSmallwood
Esri Contributor

Hi Paul,

We have a similar GeodatabaseSyncTask for the 100.X series - see GeodatabaseSyncTask QML Type | ArcGIS for Developers. The parameters type (SyncGeodatabaseParameters QML Type | ArcGIS for Developers ) lets you define layerOptions as before, so hopefully that should give you what you need. This sample should give you a idea of how to work with the API: arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_QMLSamples/Features/GenerateGeodatabase at master · Esr... .

In terms of the OfflineMapTask, I believe the expected behavior is that the non-spatial tables should be taken offline. One thing to check is that the feature service meets the requirements to be taken offline - see Work offline—ArcGIS Runtime SDK for Qt | ArcGIS for Developers 

You could also try logging the job messages after you have attempted to take the map offline - that could help identify why those tables have been skipped. If you print the Job's json that gives even more details since it will output the information for every sub-job (e.g. taking inddividual layers/tables offline).

I hope that helps - let me know how you get on.

Luke

0 Kudos
SeanKim
New Contributor III

Hi Luke,

I am Sean working with Paul.

According to your guidance, I printed job's JSON messages and here are the details. (cut from entire messages)

{
"isServerMessage": false,
"message": "Online table: Load error. DisplayName: *MASKED_NAME* Common::Error: Job error 6 Illegal state. Unable to retrieve feature service information from *MASKED_URL*.",
"severity": "warning",
"timestamp": 1568599518573
}

The tables can load under online status with the same login credential. So, it doesn't look like a permission problem. All other feature layers work fine whether is online or offline(map download).

Thanks,

Sean

0 Kudos
LukeSmallwood
Esri Contributor

Hi Sean - thanks for looking into it.

Are the tables part of the same feature service as other layers which do work correctly?

0 Kudos
SeanKim
New Contributor III

Hi Luke,

Yes, all the layers(feature layers, base layers and tables) are coming from a web map.

All the layers and tables work correctly in online status(web map load using PortalItem). But, when trying to download mmpk with default Parameters, it shows an error in job messages like above.

Even If there is an error in job messages, the download will proceed according to continueOnErrors value is true by default. But, downloaded mmpk only has base layers and feature layers from a web map. (both of the layers works well)

Thanks,

Sean

0 Kudos
LukeSmallwood
Esri Contributor

Hi Sean - did you manage to resolve this issue?

We've seen a similar sounding issue in another post (https://community.esri.com/message/886838-offline-map-does-not-include-tables ) that turned out to be because of a duplicate "Creator" field in the table.

Luke

0 Kudos
SeanKim
New Contributor III

Hi Luke,

Sorry for late. We have changed the table to a spatial one.

Thanks for your comment.

Thanks,

Sean

0 Kudos