Repository.BlockSim.ExportBlockSimXMLFile: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
(Created page with '{{Template:APIClass|Repository Class|Repository}} Synthesis API allows the programmer to export XML files out of a current project of BlockSim. The page contains the logic of tha…')
 
No edit summary
 
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Template:APIClass|Repository Class|Repository}}
{{Template:API}}{{Template:APIBreadcrumb|.[[Repository Class|Repository]]}}
Synthesis API allows the programmer to export XML files out of a current project of BlockSim. The page contains the logic of that importation. This page will demonstrate the exportation process.


== Method Syntax  ==
{{APIName|Public Function '''ExportBlockSimXMLFile'''(}}
{{APIPrefix|ByVal}}
{{APIName|FileName}}
{{APIPrefix|As String}}
{{APIName|)}}
{{APIPrefix|As Boolean}}<br>


<onlyinclude>Exports data from the current BlockSim project to a new XML file. Returns a '''Boolean''' value; when true, indicates a successful export.</onlyinclude>


== Parameters ==
'''FileName'''
{{APIComment|XML file name}}


== Usage Example ==
'''Remarks''': The XML file can include the block properties and information on how the blocks are connected in a reliability block diagram or fault tree diagram. Data on visual aspects, such as diagram style settings, block style settings, etc., are not supported.
{{APIComment|Code Block}}
'{{APIComment|Declare a new repository connection class.}}
{{APIPrefix|Private WithEvents MyRepository As [[New Repository]]}}
'{{APIComment|Connect to the Synthesis repository.}}
{{APIPrefix|Dim}}Success{{APIPrefix|As Boolean}}={{APIPrefix|False}}
  Success = MyRepository.[[Repository.ConnectToSQLRepository|ConnectToSQLRepository]]("SQLServerPath", "SQLDatabaseName")
'{{APIComment|Export the XML File out of the Synthesis repository.}}
{{APIPrefix|Dim}}SuccessExportXML{{APIPrefix|As Boolean}}
  SuccessExportXML = MyRepository.[[Repository.ExportBlockSimXMLFile|ExportBlockSimXMLFile]]("XML_File_Name")


===Reformatted Usage Example===
== Syntax ==
'''.BlockSim.ExportBlockSimXMLFile'''(''FileName'')


{{APIComment|Declare a new repository connection class.}}
=== Parameters ===
        Private WithEvents MyRepository As [[New Repository]]
''FileName''
:Required. String. The save location and name for the new XML file.


{{APIComment|Connect to the Synthesis repository.}}
        Dim Success As Boolean = False
        Success = MyRepository.[[Repository.ConnectToSQLRepository|ConnectToSQLRepository]]("SQLServerPath", "SQLDatabaseName")


{{APIComment|Export the XML File out of the Synthesis repository.}}
== Example ==
        Dim SuccessExportXML As Boolean
This example assumes that reliability block diagrams exist in the first available project in the repository.
        SuccessImportXML = MyRepository.[[Repository.ExportBlockSimXMLFile|ExportBlockSimXMLFile]]("XML_File_Name")
'''VBA|VB.NET'''
{{APIComment|'Declare a new Repository object and connect to a Synthesis repository.}}
  {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
  MyRepository.ConnectToAccessRepository({{APIString|"C:\RSRepository1.rsr10"}})
 
{{APIComment|'Export the data from project #1 in the repository. Name the file "MyBlockSimData.xml" and save it in the C: drive.}}
  MyRepository.Project.SetCurrentProject(1)
  MyRepository.BlockSim.ExportBlockSimXMLFile({{APIString|"C:\MyBlockSimData.xml"}})

Latest revision as of 20:31, 18 August 2016

APIWiki.png


Member of: SynthesisAPI.Repository


Exports data from the current BlockSim project to a new XML file. Returns a Boolean value; when true, indicates a successful export.


Remarks: The XML file can include the block properties and information on how the blocks are connected in a reliability block diagram or fault tree diagram. Data on visual aspects, such as diagram style settings, block style settings, etc., are not supported.

Syntax

.BlockSim.ExportBlockSimXMLFile(FileName)

Parameters

FileName

Required. String. The save location and name for the new XML file.


Example

This example assumes that reliability block diagrams exist in the first available project in the repository.

VBA|VB.NET 

 'Declare a new Repository object and connect to a Synthesis repository. 
  Dim MyRepository As New Repository
  MyRepository.ConnectToAccessRepository("C:\RSRepository1.rsr10")
 
 'Export the data from project #1 in the repository. Name the file "MyBlockSimData.xml" and save it in the C: drive. 
  MyRepository.Project.SetCurrentProject(1)
  MyRepository.BlockSim.ExportBlockSimXMLFile("C:\MyBlockSimData.xml")