So, you’ve been building a nice application and testing it in the Staging Runtime. While doing so, you’ve entered quite some useful data. When it’s time to go Live, you publish and start the Live Runtime of your application. Alas… no data! You will need to re-enter everything… Or maybe not?!

With the support for OData, both consuming and exposing, WEM makes it easy to transfer data from one runtime to another of your project. This is particularly useful in two cases:

  1. When you go live with your application and want to re-use data entered in Staging;
  2. When your application has been running Live for some time, containing lots of useful data and you want to get it available in Staging for testing new or changed features or investigate bugs.

So, how do you get this working? Let’s focus on number 1:

Getting data from Staging to Live

First, pepare your project for OData:

  1. Go to the project settings and select a portal;
  2. Create an OData user account on this portal (button Manage OData users in the toolbar);
  3. Save the project settings;
  4. Go back to Manage OData users; if your user does not appear, you’ve probably skipped step 3;
  5. Publish now to Staging, this will enable OData on the Staging runtime database;
  6. Go to Remote data sources in the Project tree and Add data service, from web;
  7. First, prepare your project for OData:
    • For the public url of dataservice: use the portal’s Staging url, prefixed with https:// (or http:// if your portal does not use https) and post fixed with /odata/, e.g.; Note: always use a slash (/) at the end of the OData URL!
    • Enter the credentials of the OData user entered earlier in step 2;
    • Name this service, which will then appear as a node under the remote data sources in your project tree.

Then, build flowcharts

Using the remote data source (in this case, your own Staging data). The database lists are available directly from your Project Tree and you can use them the same way as you use the database lists in your Data Model with listnodes on flowcharts, datagrids and repeaters on Templates.

You can drop a Datagrid on a template based on any of the lists in the Remote Data Source just to display the data. You can put a loopnode on such a list and copy the data to the corresponding list in your Data Model (add new row and handle each corresponding field with each iteration of this loop). Run it in preview mode to get the Staging data into Preview.

Be careful, use filters and checks where necessary!

Check if you are in the correct runtime, by using the IsLive() or IsStaging() functions (you don’t want to accidentally copy staging data into staging again…); Check if an item already exists, if you are going to use this flowchart repeatedly; Do not use the ID-fields, as they are automatically generated so they might (and probably will) be different between the Staging and Live runtimes.

Mind the Concepts! When copying staging concept fields to live concept fields, the underlying technical data is not exactly the same. Using an Assignment Node on a Live.DataModel.ConceptField and plainly assigning it with the ExternalDataSource.StagingData.DataModel.ConceptField will just not work as you might expect. But it’s easy to map it correctly with the available Ontology-functions.

For a Single Select field, use something like:

first(concept of GetChildren(‘root concept of single select’) where tostring(concept) = tostring(ExternalDataSource…SingleSelectField))

as the expression in the assignment node.

For a Multi Select field, use something like:

GetDescendants(‘root concept of multi select’) where tostring(concept) in (tostring(concept) of ExternalDataSource…MultiSelectField)

 +31 (0)20 240 21 20       

Videos and images courtesy of WEM Modeler. © 2019. WEM Modeler.
SitemapPrivacy - Terms - Company

 +31 (0)20 240 21 20       

Videos and images courtesy of WEM Modeler.
© 2019 WEM Modeler.
Sitemap - Privacy -  Terms - Company