-
Notifications
You must be signed in to change notification settings - Fork 3
SQL Tutorial
This tutorial is designed to model a very simple interaction in the myMIS platform, and use the myMIS Connector to register the documents created in that interaction into an external system (an SQL database).
Prepare your database by executing both .sql files found in this tutorial's folder:
If you are performing this tutorial on top of a tenant that was already used to execute a previous tutorial, when there is an instruction to create an Entity and then perform further operations on that entity, if you already created one with the given name, you can reuse the one that already exists.
-
Start by accessing the Modeler.
1.1. Open the user menu (click in the user name, placed in the top-right corner).
1.2. Choose the option Modeler.
-
Through the top navigation menu, access Entities > Agents. Create an Agent Type (Add new button), and set its Code and Name to "Employee". Click the Save button.
-
Access Entities > Resources. Create a Resource (Add new button), and set its Code and Name to "Hours". Click the Save button.
-
Access Processes and Interactions, click the Add new Process button and create a process with the code "TaskManagement" and the name "Task Management".
-
When the process is created, create an interaction under the process you just created using the option Add Interaction.
-
Set the Code and Name of the Interaction to "Task".
- Add an attribute (option Add Attribute in the Attributes section) to this interaction, with the Code and Name "Description", of Text type.
-
Confirm the changes to the attribute using the Accept button.
-
Add an attribute, with code and name equal to "Completed", of True/False (boolean) type.
-
Confirm the changes to the attribute using the Accept button.
-
Save the interaction.
-
Access External > Systems in the top menu.
-
Create an external system (option Add New) with the Code "SqlDatabase" and the name "Sql Database". This entity will represent the server containing our external database.
-
Edit the "SystemVersion" attribute.
-
In the Behaviour Tab, set the Default Value to 1.
-
Hide the "SystemVersion" attribute unchecking the Visible flag in the Interface tab.
-
Confirm the changes to the attribute using the Accept button.
-
Add an attribute to this system, with the Code and Name "SqlDb", of Text type.
-
You can set, in the Behaviour tab, the Default Value to TutorialDatabase, if you didn't change the database name in the provided prerequisite scripts.
-
Confirm the changes to the attribute using the Accept button.
-
Add an attribute to this system, with code and name equal to "SqlServer", of Text type.
-
Confirm the changes to the attribute using the Accept button.
-
Save the External System and it will be created.
-
Access to the Application clicking at your username at the navigation bar and then option Application.
-
Create a Company, in Configurations > myCompany > Create.
- Set the Code and Name to "myCompany"
-
Click the Save button.
-
Create a connector, in Administration > Connectors > Create.
-
Set a name to your connector (for example: SqlTutorialConnector)
-
Configure your myMIS Connector to use its endpoint and license file.
You can find more information about configuring the connector at this tutorial.
-
Ensure your SQL Database has a user with read and write privileges, for the platform to use.
-
Create a SqlDatabase external system mapping, in Configurations > Sql Database > Create, connecting the company you created to your SQL Database.
The default Username and Password fields identify the user you want to login with, and the SqlDb and SqlServer represent the C# SQLConnection InitialCatalog and DataSource attributes, respectively.
Now that we have a connection to the SQL Database ready, we can test the connector.
-
Go back to the Modeler using the side bar accessible when you click in your username, and select the option Modeler.
-
In the navigation bar click the External > Entities options
-
With the Add new option create an external entity with code "ExternalProject" and name "External Project".
-
Set the Query field:
SELECT [Code] ,[Name] ,[BeginDate] FROM [dbo].[Project] WHERE [EndDate] IS NULL -
Identify the Query Key Parameter with: Code
-
In the Script file, upload the SQLRemoteQuery_V2.cs file found in this tutorial's folder.
-
Save the External Entity.
If the connection to the database fails (for example, you did not connect the connector yet), you will see a Warning (yellow) notification (at the navigation bar), informing you that the default view for this external entity was not created.
Even after correcting the problem that caused the connection failure, creation of the list is necessary, otherwise the application will not reflect all the data in the SELECT. To create this view, access the Configure Views option on the external entity, and add the Code, Name and BeginDate fields to the list you create. It should end up looking like the (default) list below.
-
In order to test the Sql Query and the Connection, go back to the Application and access the list of the ExternalProject, through Configurations > External Project > List.
-
Verify the projects that show up are those you created in the initial setup.
-
Now, we will add a Project field to the interaction, that references the external entity we created in the last step. Go back to the modeler, and click Processes and Interactions in the menu. Edit the Task interaction.
-
Add an attribute (option Add Attribute in the Attributes section) to this interaction, with the Code and Name "Project", of Other Entity type. It should refer the kind External Entity and type ExternalProject.
-
Save the Task interaction.
-
Go back to the application and access Task Management > Task > Create. Verify the new Project field is available, and that you can select all the projects that show up in step 9.
Now, we are going to add the script that integrates the Task in the SQL database, when it is created.
-
Access Scripting in the menu and create an ExtensibilityScript called IntegrateTask.
-
Set the Entity Kind to Interaction, the Process Type to TaskManagement, and the Entity Type to Task.
-
Set the Action to Create.
-
Set the Moment to "After".
-
Add the SQLIntegrateTask_V2.cs file as its only script file, with the Execution type Remote.
-
Save the script.
-
Go back to the application.
-
Create a new Task by accessing Task Management > Task > Create.
-
Fill the form and Save.
-
In your SQL database, verify if it is integrated successfully.
-
So that it is not necessary to manually access the SQL Server to see what tasks were integrated, access the modeler again, and, in External > Entities, create a new external entity named ExternalTask.
-
Set the Query field:
SELECT [ID] ,[ProjectID] ,[Description] ,[Completed] FROM [dbo].[Task] -
Identitfy the Query Key Parameter with: ID.
-
In the Script file, upload the SQLRemoteQuery_V2.cs file found in this tutorial's folder.

-
Save the External Entity.
-
Go back to the application, and access the new list, through Configurations > ExternalTask > List, and see the task you just integrated.
You can continue the tutorials by performing the HTML/XML tutorial.
If you have any questions, or if you encounter any problems at all along the way, just contact our support team.
- Configuration
- Documentation
- Tutorials















