Solutions
...
Litmus Production Record Datab...
Interacting with Litmus Produc...

Reading out Data Model definitions

8min

Use Cases

Reading out the Data Model definition can be used to verify what data models do exist and what items and levels are defined. This is most useful, when creating a new data model or wanting to modify an existing data model.

User can do this either by using applications such as:

  • Microsoft SQL Server Management Studio
  • MSSQL CLI

This can also be used for building custom solutions based on applications which allow for an ODBC connection such as:

  • Excel
  • C#
  • .Net
  • Python

Litmus does provide such as custom solution which can be downloaded from our Central Portal.

Method

Run SELECT query with Function PROREC_ProRec_GetHierarchy as FROM clause.

Note

Data Models are a hierarchy used to organize and relate Production Record Event data according to ISA-88 rules.

Input Variables

Variable name

Datatype

Description

Example

@NodeName

VARCHAR(50)

The name of a root Node of a specific data model. If no specific NodeName is to be queried or to get a list of NodeName's, the value can also be DEFAULT which will assume the value %.

DownTime





DEFAULT

How to use

To read out all or a specific data model definition, execute a SELECT statement from the function PROREC_ProRec_GetHierarchy providing all the required inputs. Below is an example using T-SQL in SQL Server Management Studio:

SELECT * FROM [LE_ProductionRecord].[dbo].[PROREC_ProRec_GetHierarchy ] ( DEFAULT);

Result

The function returns a table as result.

Read data models
Read data models


Additional Options

It is possible to reduce the number of columns returned by the SELECT statement. Below is an example using T-SQL in SQL Server Management Studio:

SELECT NodeName, Item, ValueType, Identifier FROM [LE_ProductionRecord].[dbo].[PROREC_ProRec_GetHierarchy] ( 'DownTime');

This will reduce the number of columns returned to only the four selected.

get reduced hierarchy data
get reduced hierarchy data


It is possible to sort data based on users requirements returned by the SELECT statement. Below is an example using T-SQL in SQL Server Management Studio:

SELECT NodeName, Item, ValueType, Identifier FROM [LE_ProductionRecord].[dbo].[PROREC_ProRec_GetHierarchy] ( 'DownTime') order by Item asc;

The result will be a table, where all rows are sorted by their Item Name in ascending order.

sort results for hierarchy
sort results for hierarchy