Using the Synthesis API to Transfer Data to a Synthesis Repository

[Editor's Note: This article has been updated since its original publication to reflect a more recent version of the
software interface.]

An application programming interface (API) is a set of functions, routines, protocols and other data transmission formats that provide access to a given application through calls, rather than through the user interface. The Synthesis API is written for Visual Basic for Applications (VBA) and Visual Basic.NET. This gives you the ability to create automated solutions using popular Microsoft Office applications, such as Excel and PowerPoint, as well as create custom applications for your organization.

This article will demonstrate one example of how you could use the Synthesis API to transfer data from an Excel worksheet to a Synthesis repository. It assumes some basic working knowledge of VBA. Similar approaches could be used to obtain data from other sources as well.

Example

The Synthesis Data Warehouse (SDW) — formerly called "Reliability Data Warehouse" — is a temporary data storage location in a Synthesis repository. In Version 10, the SDW can connect to
XFRACAS, SQL Server, ORACLE or Microsoft Access databases and extract data for use in Weibull++, ALTA or RGA standard folios. You can also use the import/export utilities available in all Synthesis desktop applications to extract data from Excel files or delimited text files. These cover most applications, but what if you want to further customize the data extraction, connect to other third-party data sources, or add controls not available via the software interface?

With a little bit of coding and the Synthesis API, you could create custom solutions for moving data over to a Synthesis repository. To demonstrate this capability, we will use data from an Excel file as an example.

Example life data in an Excel file

The following code demonstrates one example of how you could create a solution for the Excel data shown above. The code first extracts the data from the Excel worksheet. When the extraction is completed, it opens a connection to a Synthesis repository, and then saves the extracted data to the Synthesis Data Warehouse in that repository.
To test and tweak the code yourself, download the example for Version 10: API_Example.xlsm (75 KB).

Sub SDW_Example()
'Create a RawDataSet object to represent the Excel data source.Dim DataSrc AsNew RawDataSet
'Name it "New Data Collection" and specify that it is for'use with Weibull++.
DataSrc.ExtractedName = "New Data Collection"
DataSrc.ExtractedType = RawDataSetType_Weibull
'To extract the data from Excel, create a RawData'object to represent a single row of data from the worksheet.Dim Row AsNew RawData
'Then read each row of data from the Excel worksheet.Dim i AsInteger, MaxRow AsInteger
MaxRow = 100For i = 2To MaxRow
Set Row = New RawData
'Set the desired properties for the current row of data.
Row.StateFS = Sheet1.Cells(i, 1)
Row.StateTime = Sheet1.Cells(i,2)
Row.FailureMode = Sheet1.Cells(i,3)
'Add the data in the current row to the data collection.Call DataSrc.AddDataRow(Row)
Next i
'Create a new Repository object to represent a Synthesis repository.Dim MyRepository AsNew Repository
'Connect to a Synthesis repository. The following code'assumes that a standard repository called'"RSRepository1.rsr10" exists in the C: drive.
MyRepository.ConnectToRepository ("C:\RSRepository1.rsr10")
'Save the extracted data collection to the repository.Call MyRepository.SaveRawDataSet(DataSrc)
'Disconnect from the repository.Call MyRepository.DisconnectFromRepository
EndSub

Sample VBA code to transfer data from the Excel file to the SDW

To verify that the data set is successfully imported into the SDW, open Weibull++, choose
Home > Synthesis > Synthesis Data Warehouse and then select the new data collection. You can then transfer the data collection from the SDW to a Weibull++ standard folio for life data analysis.

Conclusion

The Synthesis API includes various functions that enable customization and seamless integration of the platform with other systems within your organization. The example demonstrates one simple solution for using the API to customize a data transfer from an Excel worksheet to a Synthesis repository. With skill and creativity, you could create more complex solutions that fit your organization’s particular needs.