Repository.BlockSim.ImportBlockSimXMLFile: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
{{Template:APIClass|Repository Class|Repository}}
{{Template:API}}{{Template:APIBreadcrumb|10|.[[Repository Class|Repository]]}}
This Synthesis API allows the programmer to import XML file into a current project of BlockSim. The file must XML format supported by BlockSim.


== Syntax  ==
*ImportBlockSimXMLFile( XMLFile {{APIPrefix|As String}} ) {{APIPrefix|As Boolean}}


Parameters
<onlyinclude>Imports data from an XML file into a BlockSim project. Returns a '''Boolean''' value; when true, indicates a successful import.</onlyinclude>
:''XMLFile'': The path for the XML file to import.
In BlockSim, the XML files 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.ImportBlockSimXMLFile'''(''XMLFile'')


{{Template:BooleanReturn.Cmt}}
=== Parameters ===
''XMLFile''
:String. The complete path to the XML file to be imported.


== Usage Example ==
== Example ==
  '{{APIComment|Declare a new repository connection class.}}
This example assumes that an XML file called "BlockSimData.xml" exists in the C: drive. The code ignores the return value.
{{APIPrefix|Private WithEvents MyRepository As New Repository}}
  '''VBA|VB.NET'''
   
   
  '{{APIComment|Connect to the Synthesis repository.}}
  {{APIComment|'Add code to connect to a Synthesis repository.}}
{{APIPrefix|Dim}}Success{{APIPrefix|As Boolean}}={{APIPrefix|False}}
  {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
  Success = MyRepository.[[Repository.ConnectToSQLRepository|ConnectToSQLRepository]]("SQLServerPath", "SQLDatabaseName")
  {{APIComment|...}}
   
   
{{APIComment|'Set a first available project as current.}}
  MyRepository.Project.SetCurrentProject(0)
   
   
  '{{APIComment|Import the XML File to the Synthesis repository.}}
  {{APIComment|'Import the data from the XML file into project #1 in the repository.}}
{{APIPrefix|Dim}}SuccessImportXML{{APIPrefix|As Boolean}}
  MyRepository.Project.SetCurrentProject(1)
  SuccessImportXML = MyRepository.BlockSim.ImportBlockSimXMLFile("XMLFilePath")
  MyRepository.BlockSim.ImportBlockSimXMLFile({{APIString|"C:\BlockSimData.xml"}})

Revision as of 21:07, 21 July 2015

APIWiki.png


Member of: SynthesisAPI10.Repository


Imports data from an XML file into a BlockSim project. Returns a Boolean value; when true, indicates a successful import.

In BlockSim, the XML files 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.ImportBlockSimXMLFile(XMLFile)

Parameters

XMLFile

String. The complete path to the XML file to be imported.

Example

This example assumes that an XML file called "BlockSimData.xml" exists in the C: drive. The code ignores the return value.

VBA|VB.NET 

 'Add code to connect to a Synthesis repository. 
  Dim MyRepository As New Repository
  ... 


 'Import the data from the XML file into project #1 in the repository. 
  MyRepository.Project.SetCurrentProject(1)
  MyRepository.BlockSim.ImportBlockSimXMLFile("C:\BlockSimData.xml")