Data and Datamodels
Introduction
Every LogicNets-based application uses data objects -- the names applied to the questions and fields displayed to users in applications -- and LogicNets organizes this data into structures called datamodels. The system builds these datamodels as you add forms/form-parts, calculations, or other elements that make up your applications. You can view datamodels at the project level by clicking the Data tab of your project, where the system displays each discrete use of a data variable as well as the path where that variable exists, the data type, related captions, where the data is defined, and any associated options.
LogicNets color codes datamodel rows and these colors have specific meanings:
- Blue line items are IMPLICIT data objects. This means they were created in the datamodel as you defined data objects while modeling your logicnets.
- Red line items are also IMPLICIT data objects, but the data object name has been used in more than one place in your logicnets and there is meta data in conflict; for example, the caption used with each one is different.
- White line items are those data objects that were imported via a named datamodel and not defined as you modeled your logicnets. Items in white are not in conflict.
Note: Data objects in conflict are not an indication of an error or defect in the modeling. Especially in the LogicNets Assessment Framework, you may specifically apply alternate captions for an object in the Q&A versus the Report sections.
Using the Datamodel
The datamodel table can be very useful when you are building applications, especially if you are working in collaboration with another Designer user. If you have created a data object previously and want to use that data object in another form part, report part, or process node, the datamodel allows you to select a variable from it by clicking the ellipsis button next to a data object field in your parts. When you click this button the system shows you the datamodel and allows you to pick an item from it. This ensures the following:
- There is consistent use of each variable name, so you don't introduce defects by mis-typing or recalling a variable name incorrectly
- The system transfers question options
- The system transfers any captions
If you need to change a caption or answer option after you clicked on the ellipsis button you can definitely do that and the system will overwrite the options. The next time you go to the datamodel you will see that your data object is listed twice and it is in conflict.
You can sort the datamodel using the column title, and you can also change the number of records the system displays on the page. Using your browser's text search, you can find a particular text string listed in the datamodel--remember that the browser text search is only searching the records displayed on the screen. To search for all nodes in the project that reference a particular data object, click on the search icon at the far right of the table. This starts the LogicNets Search function and the system presents a list of each instance in the application where the object is used. See Advanced Search Overview for more information on this.
Managing Data Models
While the system will build your application's data model as you add dataobjects, it is also possible to predefine a list of variable names and types to use in the Designer. This is useful for a variety of reasons, including when you have multiple Designer users are creating projects using common variable names and you want to establish a standard naming convention. The following sections detail creating and adding to datamodels. Projects can have more than one datamodel.
Create a New Datamodel
- To manually create a datamodel, navigate to the Project pane in the Designer, click the name of the project in which you want to create your datamodel, and navigate to the datamodel subfolder.
- Click the New Datamodel icon.
- Enter the name you want to use for your datamodel and click OK.
- To add entries in your datamodel, click the name of your newly added datamodel and click the New button.
- Add the first dataobject and type and click Save to save that entry. Continue these steps until you have added each of the dataobjects in your datamodel.
Copy an Existing Datamodel
If you have an existing datamodel in a different project in your Designer account you can copy and paste that datamodel into another project.
- Navigate to the datamodel you want to copy.
- Click the Copy icon in the Project pane.
- Navigate to the datamodel folder of the project into which you want to paste the copied datamodel.
- Click the Paste or Paste Link icons. Paste creates an independent copy of the datamodel where changes to the original are NOT reflected in the copy. Paste Link retains a link to the original, so that any changes to the original or paste-linked datamodel will be reflected.
Import an Existing Datamodel
Another way to create a datamodel is to import it as a JSON file from a file external to the Designer.
- Navigate to the datamodels folder of the project into which you want to import your datamodel.
- Create a new datamodel using the steps above.
- Click on your new datamodel and click import.
- Follow the instructions on the screen to select and upload a JSON-formatted file.
The import function will process a file with .JSON extension. The following JSON types are supported and LogicNets will recognize and map them to LogicNets' internal data types.
- String
- Number
- Arrays
- Object
Note: Prior to LogicNets Release v7.4, null values and Boolean types true, false are not supported. In Releases prior to 7.4. the LUA to JSON part can be used as part of a runtime application with the option to manually override in case of false or null value.
Add to a Datamodel
You can manually create or add to a project's datamodel.
- Navigate to the datamodel to which you want to add entries.
- Click the new button and enter the id, path, and type. You can also add the caption and other data.
- Click save to save your updates.
Expand a Datamodel
Another way to expand the datamodel is to add variables that have been created during content modeling.
- First, associate the datamodel with the target logicnet by going to your logicnet, clicking the Details tab, and select the datamodel from the Datamodel dropdown menu.
- Click save to save your selection.
- Click your logicnet again and click the Data tab.
- Select Project from the Scope dropdown menu.
- Click one or more variables to add to the specified datamodel.
- Click add to datamodel.
Update a Datamodel by Syncing
While modeling a logicnet, if you edit a question that is part of the datamodel (e.g. change the caption, add more options) the Data view will show both the datamodel entry and the local entry as two separate lines that are in conflict. You can do one of the following:
- Leave the conflict in place. You would choose this option if the datamodel is shared but the edits are related to a one-time, single-application use.
- Sync the datamodel and local definitions. You would choose this action if you are expanding the datamodel to include a broader set of questions and answers.
- To sync the datamodel and local definitions, go to the Data tab.
- Select the scope of the action using the Scope dropdown menu.
- Click sync. The system resolves the conflict and the datamodel assumes the updated type, caption, options from the local model.
Before Sync
After Sync
Example
You can import the attached sample file (sample_datamodel_import.JSON) into a new datamodel to demonstrate the feature and variable types. The import file and resulting data model are shown in the screenshots below.