User Tools

Site Tools


This translation is older than the original page and might be outdated. See what has changed.

Introduction to Sprinkler




eeRis Sprinkler v.1.2.00
for Microsoft Dynamics NAV 2016 / NAV 2017 / NAV 2018 / Dynamics 365 Business Central on-prem

"On Demand" Replication Function

In Sprinkler eeLite version, developers can use the new “On Demand” replication function.

This feature will allow you to manage, for example, the following scenarios:

  • The automatic data export is not active, or you just want to replicate one or more records in the target database.
  • Before the activation of the automatic data export, you want to feed all the tables with current data (this operation was however already possible through manual Advanced Replication Functionality)
  • You want to build a test scenario with a series of predetermined data, and the operation must be repeatable.
  • You have to archive one or more tables data on a historical database: for example, sale and purchase documents with related tables, with [Posting Date] lower than a specified date.

There is a public Function of [Spk Management] codeunit that allows you to reach the goal:

Replicate_Record(parmRecord : Variant, Peer : GUID)

parmRecord: can be both Record and RecordRef type variable

Example - You need to replicate to a remote historical database the data of tables [Sales Invoice Header], [Sales Invoice Line] and corresponding [G/L Entry] so you can navigate those documents correctly. All the documents with [Posting Date] up to 12/31/2016 must be copied. We suppose that the schema of all involved tables are identical in Source and Target Peer's databases.

Before to start, in the Target Peer you have to create the following Importing Setup for all [Sales Invoice Header], [Sales Invoice Line] and [G/L Entry] tables: this setup will be active in ~1 minute. No further setup are necessary on the Source Peer.

Solution - Create the following variables:

Name DataType SubType
SpkMgt Codeunit Spk Management
Peer Record Data Distrib. Peer
SalesInvHdr Record Sales Invoice Header
SalesInvLine Record Sales Invoice Line
GLEntry Record G/L Entry

The code is:

LastDate := 311216D;
Peer.GET('{60632e40-a50d-11e7-9598-0800200c9a66}');    //Remote Peer ID

SalesInvHdr.SETFILTER("Posting Date",'<=%1',LastDate);
  SpkMgt.Replicate_Record(SalesInvHdr,Peer."Server ID");

  SalesInvLine.SETRANGE("Document No.",SalesInvHdr."No.");
    SpkMgt.Replicate_Record(SalesInvLine,Peer."Server ID");
  UNTIL SalesInvLine.NEXT = 0;

  GLEntry.SETRANGE("Document Type",GLEntry."Document Type"::Invoice);
  GLEntry.SETRANGE("Document No.",SalesInvHdr."No.");
    SpkMgt.Replicate_Record(GLEntry,Peer."Server ID");
  UNTIL GLEntry.NEXT = 0;

UNTIL SalesInvHdr.NEXT = 0;
en/ondemandreplication.txt · Last modified: 2017/09/29 14:51 (external edit)