Transfer Data to the Synthesis Data Warehouse (SDW)

 << Back to API Tutorials

Transfer Data to the SDW
 * VBA Tutorial
 * VB.NET Tutorial
 * References

The Synthesis Data Warehouse (SDW) — formerly called "Reliability Data Warehouse" — is a temporary data storage location in a Synthesis repository. With the Synthesis API, you can transfer data from external sources into the SDW of a repository for use in Weibull++, ALTA or RGA standard folios.

In the following tutorial, you'll create a simple solution for moving data from an Excel file over to the SDW. The tutorial is available for both VBA and VB.NET. Note that the tutorial demonstrates one particular approach for extracting data from Excel. It's for demonstration purposes only; it doesn't take efficiency into account and doesn't include any exception handling. To complete the tutorial successfully, please use the sample Excel data given below.

Create an Excel file for this tutorial
Before you begin the tutorial, please create an Excel file to use as your sample data.

Copy and paste the following data to the Excel file. Be sure to select cell A1 in Sheet1 of the workbook when pasting the data. Save the Excel file as "SampleData."

VBA Tutorial: Transfer Data from an Excel File to the SDW
Before you begin, be sure to reference the Microsoft Excel Object Library. Choose Tools > Reference, and then select the library from the list. Click OK.

1. Create a new module and start with the following code to create an SDW data collection. The code uses the  object to represent the SDW data collection, and the   property to specify that the data collection is for use with Weibull++.

VBA DataCollection RawDataSet DataCollection.ExtractedName = DataCollection.ExtractedType = RawDataSetType_Weibull

2. Use the  object to represent a single row of data, and then use the   method to add the row to the data collection.

The following code demonstrates one way to extract a row of data from the Excel sheet. For, the code creates a new   object, and then sets its properties by using the values from row #2 of the Excel file. After the code finishes reading the row of data, it adds the object to the data collection. When the code reaches, it increases   with 1 and jumps back to the   statement, which adds another new   object for the data in row #3 of the Excel sheet, and so on. The loop continues until  reaches the specified number of rows (MaxRow).

VBA Row RawData i Integer, MaxRow  Integer MaxRow = 20 i = 2 MaxRow Row = RawData Row.StateFS = Sheet1.Cells(i, 1) Row.StateTime = Sheet1.Cells(i,2) Row.FailureMode = Sheet1.Cells(i,3) DataCollection.AddDataRow(Row) i

3. The next step is to save the data collection to the Synthesis repository.

Connect to the Synthesis repository and then use the  method to save the data collection to the repository.

VBA MyRepository Repository MyRepository.ConnectToRepository MyRepository.DataWarehouse.SaveRawDataSet(DataCollection)

Test the Code
Below is the complete code list for this VBA example. On the Debug menu, click Start to run the application. Then verify that the data were imported by launching Weibull++, opening the SDW (Home > Synthesis > Synthesis Data Warehouse) and then selecting the new data collection. (You may need to display the StateTime, StateFS and FailureMode columns by right-clicking a column header and choosing Select Columns.)

VBA Sub Main DataCollection RawDataSet DataCollection.ExtractedName = DataCollection.ExtractedType = RawDataSetType_Weibull Row RawData i Integer, MaxRow  Integer MaxRow = 20 i = 2 MaxRow Row = RawData Row.StateFS = Sheet1.Cells(i, 1) Row.StateTime = Sheet1.Cells(i,2) Row.FailureMode = Sheet1.Cells(i,3) DataCollection.AddDataRow(Row) i   MyRepository  Repository MyRepository.ConnectToRepository MyRepository.DataWarehouse.SaveRawDataSet(DataCollection) End Sub

VB.NET Tutorial: Transfer Data from an Excel File to the SDW
Before you begin, be sure to reference the Microsoft Excel Object Library. Choose Project > Add Reference, and then select the library from the COM tab. Click OK.

Create a new form. On the code page, add an Imports statement for.

1. Start with the following code to create an SDW data collection. The code uses the  object to represent an SDW data collection, and the   property to specify that the data collection is for use with Weibull++.

VB.NET DataCollection RawDataSet DataCollection.ExtractedName = DataCollection.ExtractedType = RawDataSetType.Weibull

2. Use the  object to represent a single row of data, and then use the   method to add the row to the data collection.

The following code demonstrates one way to extract a row of data from the Excel file. First, the code opens a connection to the Excel file and specifies the active sheet (in this case, Sheet1). Then, the code creates a new   object and sets its properties by using the values from row #2 of the Excel file. After the code finishes reading the row of data, it adds the object to the data collection. When the code reaches, it increases   with 1 and jumps back to the   statement, which adds another new   object for the data in row #3 of the Excel sheet, and so on. The loop continues until  reaches the specified number of rows (MaxRow). Finally, the code closes the connection to the Excel file.

VB.NET Row RawData Excel Application Workbook Workbook Sheet Worksheet Workbook = Excel.Workbooks.Open Sheet = Workbook.Sheets(1) i Integer, MaxRow  Integer MaxRow = 20 i = 2 MaxRow Row = RawData Row.StateFS = sheet.Cells(i, 1).text Row.StateTime = sheet.Cells(i, 2).value Row.FailureMode = sheet.Cells(i, 3).text DataCollection.AddDataRow(Row) i  Workbook.Close Excel.Quit

3. The next step is to save the data collection to the Synthesis repository.

Connect to the Synthesis repository and then use the  method to save the data collection to the repository.

VB.NET MyRepository Repository MyRepository.ConnectToRepository MyRepository.DataWarehouse.SaveRawDataSet(DataCollection)

Test the Code
Below is the complete code list for this VB.NET example. On the Debug menu, click Start to run the application. Then verify that the data were imported by launching Weibull++, opening the SDW (Home > Synthesis > Synthesis Data Warehouse) and then selecting the new data collection. (You may need to display the StateTime, StateFS and FailureMode columns by right-clicking a column header and choosing Select Columns.)

VB.NET SynthesisAPI Microsoft.Office.Interop.Excel Form1 Button1_Click(sender System.Object, e  System.EventArgs)  Button1.Click DataCollection RawDataSet DataCollection.ExtractedName = DataCollection.ExtractedType = RawDataSetType.Weibull Row RawData Excel Application Workbook Workbook Sheet Worksheet Workbook = Excel.Workbooks.Open Sheet = Workbook.Sheets(1) i Integer, MaxRow  Integer MaxRow = 20 i = 2 MaxRow Row = RawData Row.StateFS = sheet.Cells(i, 1).text Row.StateTime = sheet.Cells(i, 2).value Row.FailureMode = sheet.Cells(i, 3).text DataCollection.AddDataRow(Row) i       Workbook.Close Excel.Quit MyRepository Repository MyRepository.ConnectToRepository MyRepository.DataWarehouse.SaveRawDataSet(DataCollection)