Import data from other SQL servers
No edit summary
No edit summary
Line 53: Line 53:
In MDriven Designer (formerly AppComplete) I can create a Class2 with the debugger and save it:
In MDriven Designer (formerly AppComplete) I can create a Class2 with the debugger and save it:


[[File:Import - 7.png|frameless]]
[[File:Import - 7.png|frameless|244x244px]]


And then I check the MDriven Server log:
And then I check the MDriven Server log:
Line 61: Line 61:
I then check my Class2:
I then check my Class2:


[[File:Import - 9.png|frameless]]
[[File:Import - 9.png|frameless|244x244px]]


Attribute1 is now ‘Done’ – so the serverside job relaxes and will not find anything more to do just now…
Attribute1 is now ‘Done’ – so the serverside job relaxes and will not find anything more to do just now…

Revision as of 14:43, 21 October 2018

MDriven Server – the new name for BorPred – has been extended with functionality to import data from other sqlbased systems.

The MDriven Server is designed for taking care of the repetitive common tasks that always seems to come back and haunt us system developers. MDriven Server takes a strictly model driven approach to help you with the work.

Earlier I described how to export files Exporting files from MDriven Server#Producing export files from MDriven Server

and this here is a link to explain more about the concept periodic actions MDrivenServer periodic server-side actions

What is new today is the ability to read from an external SQL server and import that data – strictly by using MDriven techniques and zero need for external programs.

Let me show you.

I have this model and I really want class1 to be reference data from an external database:

Import - 1.png

So I declare a viewModel that looks like this:

Import - 2.png

It defines 4 columns with data and 2 actions.

1=ViewModel - the name of yet another viewmodel that will act as a importer of the sql result set

2=Connectionstring- the external database

3=Query – the sql query – remember that you can build it with data from the rest of your model

4=Key – if we want the import to be able to update Class1 we need to explain what the key is in the class

And the actions:

SQLImport – using this name will trigger the import function in MDriven Server

Finished – this is a generic action – that just execute the expression – in this case setting Class2.Attribute1 to ‘Done’

So the SQL data returned looks like this:

Import - 3.png

And the ViewModel that is going to act as the import template – called “TheImporter” in the example above looks like this:

Import - 4.png

I now declare the ServerSide job in MDriven server:

Import - 5.jpg

The actual import is executed by the import logic described here: Import Data

Now the MDriven Server will check every 20:seconds if the expression Class2.allinstances->select(attribute1=’todo’) returns any rows. If it does - it fetches at most 2 of these and executes all the actions found in TheServerSideJob.

In MDriven Designer (formerly AppComplete) I can create a Class2 with the debugger and save it:

Import - 7.png

And then I check the MDriven Server log:

Import - 8.png

I then check my Class2:

Import - 9.png

Attribute1 is now ‘Done’ – so the serverside job relaxes and will not find anything more to do just now…

This page was edited 78 days ago on 01/11/2024. What links here