<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Question:  ExportDeltaAsync in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/question-exportdeltaasync/m-p/1541536#M13037</link>
    <description>&lt;P&gt;I was looking at the ExportDeltaAsync method to use in a custom sync workflow we have.&amp;nbsp; What is unclear to me is how you could trim the results of this to be only the edits since a certain time.&lt;/P&gt;&lt;P&gt;If I were to use&amp;nbsp;ExportDeltaAsync at 12:00 and then send those to the server and sync that delta file to the server.&amp;nbsp; If I run the&amp;nbsp;ExportDeltaAsync at 1:00, it would seem I will still get all the edits from before 12:00.&amp;nbsp; Is there a way to reset the HasEdits on the Geodatabase or some other other way that one only Exports the Deltas since the last time that&amp;nbsp;ExportDeltaAsync was called?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Sep 2024 17:31:02 GMT</pubDate>
    <dc:creator>JoeHershman</dc:creator>
    <dc:date>2024-09-23T17:31:02Z</dc:date>
    <item>
      <title>Question:  ExportDeltaAsync</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/question-exportdeltaasync/m-p/1541536#M13037</link>
      <description>&lt;P&gt;I was looking at the ExportDeltaAsync method to use in a custom sync workflow we have.&amp;nbsp; What is unclear to me is how you could trim the results of this to be only the edits since a certain time.&lt;/P&gt;&lt;P&gt;If I were to use&amp;nbsp;ExportDeltaAsync at 12:00 and then send those to the server and sync that delta file to the server.&amp;nbsp; If I run the&amp;nbsp;ExportDeltaAsync at 1:00, it would seem I will still get all the edits from before 12:00.&amp;nbsp; Is there a way to reset the HasEdits on the Geodatabase or some other other way that one only Exports the Deltas since the last time that&amp;nbsp;ExportDeltaAsync was called?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 17:31:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/question-exportdeltaasync/m-p/1541536#M13037</guid>
      <dc:creator>JoeHershman</dc:creator>
      <dc:date>2024-09-23T17:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Question:  ExportDeltaAsync</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/question-exportdeltaasync/m-p/1542618#M13038</link>
      <description>&lt;P&gt;Hi Joe,&lt;/P&gt;
&lt;P&gt;The&amp;nbsp;&lt;A title="ExportDeltaAsync" href="https://developers.arcgis.com/net/api-reference/api/net/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Tasks.Offline.GeodatabaseSyncTask.ExportDeltaAsync.html" target="_blank" rel="noopener"&gt;ExportDeltaAsync&lt;/A&gt;&amp;nbsp;is based on the last sync time on the geodatabase. I just tested the following code, if there's a syncGeodatabase happened in between, no delta is created. Code snippet against sample server is shared below.&lt;/P&gt;
&lt;P&gt;HasEdits only reset after edits are applied/sync'd or undone/rolled back. Edits in a mobile geodatabase can be wrapped in explicit transaction by gdb.Begin/Commit/RollbackTransaction().&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're uploading client delta a different way, the API will not&amp;nbsp; have information about the last acknowledged update to compare with the edit and gdb tracking fields. Geodatabase.hasLocalEdits(), ArcGISFeatureTable.hasLocalEdits() and ArcGISFeatureTable.g&lt;SPAN&gt;etLocalEditsAsync() are all based on this time. There's a GeodatabaseFeatureTable.getHasLocalEditsSince() with DateTimeOffset parameter that you could use but it only returns boolean.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Is there something in the current sync workflow that can be improved to support your custom sync processes?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;private const string FeatureServiceUrl = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Sync/SaveTheBaySync/FeatureServer";

private async Task TestExportDeltaAsync(bool syncBeforeExport = false)
{
    try
    {
        var task = await GeodatabaseSyncTask.CreateAsync(new Uri(FeatureServiceUrl));
        var areaOfInterest = task.ServiceInfo?.FullExtent;
        ArgumentNullException.ThrowIfNull(areaOfInterest);
        var parameters = await task.CreateDefaultGenerateGeodatabaseParametersAsync(areaOfInterest);
        var pathToGeodatabase = $@"C:\dev\gdb\{Guid.NewGuid()}.geodatabase";
        Debug.WriteLine(pathToGeodatabase);
        var job = task.GenerateGeodatabase(parameters, pathToGeodatabase);
        var gdb = await job.GetResultAsync();

        // introduce an edit
        areaOfInterest = gdb.GenerateGeodatabaseGeometry?.Extent;
        ArgumentNullException.ThrowIfNull(areaOfInterest);
        if (gdb.GetGeodatabaseFeatureTable(0) is GeodatabaseFeatureTable table)
        {
            await table.LoadAsync();
            if (table.GeometryType == GeometryType.Point 
                &amp;amp;&amp;amp; table.FeatureTypes.Count &amp;gt; 0 
                &amp;amp;&amp;amp; !string.IsNullOrEmpty(table.LayerInfo?.DisplayFieldName))
            {
                var random = new Random();

                var index = random.Next(0, table.FeatureTypes.Count - 1);
                var featureType = table.FeatureTypes[index];

                double x = areaOfInterest.XMin + random.NextDouble() * areaOfInterest.Width;
                double y = areaOfInterest.YMin + random.NextDouble() * areaOfInterest.Height;
                var point = new MapPoint(x, y, areaOfInterest.SpatialReference);

                var feature = table.CreateFeature(featureType, point);
                feature.SetAttributeValue(table.LayerInfo.DisplayFieldName, $"Added on {DateTimeOffset.UtcNow}");
                await table.AddFeatureAsync(feature);
            }
        }

        if (syncBeforeExport)
        {
            var syncParameters = await task.CreateDefaultSyncGeodatabaseParametersAsync(gdb);
            var syncJob = task.SyncGeodatabase(syncParameters, gdb);
            await syncJob.GetResultAsync();
        }

        var deltaPath = $@"{gdb.Path.Replace(".geodatabase", "")}-delta.geodatabase";
        var hasDeltaExported = await GeodatabaseSyncTask.ExportDeltaAsync(gdb, deltaPath);
        Debug.WriteLine($"Exported? {hasDeltaExported}");
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.Message);
    }
}

private async void OnExportDelta(object sender, RoutedEventArgs e)
{
    await TestExportDeltaAsync(true);
    await TestExportDeltaAsync(false);
}&lt;/LI-CODE&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;Jennifer&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2024 18:21:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/question-exportdeltaasync/m-p/1542618#M13038</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2024-09-25T18:21:50Z</dc:date>
    </item>
  </channel>
</rss>

