Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Open - method of object PmTrend

Description:
Opens or creates new trend archive and access its data.
Syntax:
Open(sSourceType As String, sSource As String, [sConnection As String]) As Boolean
Calling:
oTrend.Open sSourceType, sSource, sConnection
Parameters:
sSourceType(String) Specified the type of the archive whose data will be accessed by calling the method.
"accesscyclic" (optional) - Open the archive by the technology Database Access cyclic.
"mssqlcyclic" (optional) - Open the archive by the technology Database MS SQL server cyclic.
"oraclecyclic" (optional) - Open the archive by the technology Database Oracle cyclic.
"mysqlcyclic" (optional) - Open the archive by the technology Database MySQL cyclic.
"firebirdcyclic" (optional) - Open the archive by the technology Database FireBird cyclic.
"promoticcyclic" (optional) - Open the archive by the technology Promotic binary file cyclic.
"accessbackup" (optional) - Open the archive by the technology Database Access backups (obsolete).
"dbasebackup" (optional) - Open the archive by the technology Database dBase backups.
"mssqlbackup" (optional) - Open the archive by the technology Database MS SQL server backups (obsolete).
sSource(String) Specifies the data source to which the PmTrend is connected. Entries with assigned value are separated by a semicolon, for example "database:c:\database.mdb;table:data;".
"server:xxx;" (optional) - (ignored if the the parameter is sConnection)The name of the SQL server from which the data will be read. Not specified if the sSourceType parameter is set to "accesscyclic", "accessbackup", "dbasebackup" or "promoticcyclic".
"user:xxx;" (optional) - (ignored if the the parameter is sConnection)The user for the access to the SQL server. Not specified if the sSourceType parameter is set to "accesscyclic", "accessbackup", "dbasebackup" or "promoticcyclic".
"password:xxx;" (optional) - (ignored if the the parameter is sConnection)The user password for the access to the SQL server. Not specified sSourceType parameter is set to "accesscyclic", "accessbackup", "dbasebackup" or "promoticcyclic".
"database:xxx;" (optional) - (ignored if the the parameter is sConnection)The database for data storage is defined here. If the sSourceType parameter is set to:
"mssqlcyclic", "oraclecyclic", "mysqlcyclic", "firebirdcyclic", "mssqlbackup": the SQL database is defined here.
"dbasebackup": the *.dbf files folder is defined here.
"accesscyclic", "accessbackup": the *.mdb file is defined here.
"promoticcyclic": the *.ht file folder is defined here.
"table:xxx;" (optional) - Specifies the table or table prefix where the data is stored. If the sSourceType parameter is set to:
"mssqlcyclic", "oraclecyclic", "mysqlcyclic", "firebirdcyclic", "accesscyclic": the table name with cyclic data is set here.
"dbasebackup": the prefix (first part) of the backup names (tables in database) is defined here, the complete name consists of this prefix followed by the date/time. If the complete *.dbf filename is defined here (including the suffix) then only a single file is viewed (not a set of backups). Note!It is possible to enter a complete *.dbf filename including the path (folder). Then the path is not entered in the "database:" parameter. The compete path can also be entered as #data:.
"mssqlbackup", "accessbackup": the prefix (first part) of the backup names (tables in database) is defined here, the complete name consists of this prefix followed by the date/time or serila number.
"promoticcyclic": the *.ht cyclic file filename is defined here (can be entered with the extension). Note! Is is also possible to enter the comlete *.ht file filename including the path (folder). Then the path is not entered in the "database:" parameter. The compete path can also be entered as #data:.
"coltimename:xxx;" (optional) - The name of the table column is entered here (specified by the table parameter), where the time is stored. The parameter can not be entered when the sSourceType is set to "mssqlbackup", "accessbackup", "dbasebackup" or "promoticcyclic".
"colattrname:xxx;" (optional) - The name of the table column is entered here (specified by the table parameter), where attributes are stored. It is filled up only when the database table is accessed that was created by archiving the data by the PmTrend object, otherwise this parameter is set empty. The parameter cannot be entered if the sSourceType is set to "mssqlbackup", "accessbackup", "dbasebackup" or "promoticcyclic".

Caution! If the a databse table is being opened, that is not created by PmTrend object and contain no atribute column, then the parameter must be empty value (colattrname:;), otherwise the default value "pm_attr" would be used.

"backupcount:xxx;" (optional) - Defines the backup (tables) number in the trend archive. It is used only if the sSourceType parameter is set to "mssqlbackup", "accessbackup" or "dbasebackup".
"backupsizerows:xxx;" (optional) - Defines the size - number of lines - of one backup (table) in the trend archive. It is not used if the sSourceType parameter is set to "mssqlbackup", "accessbackup" or "dbasebackup".
"backupsizetime:xxx;" (optional) - Defines the time span of one backup (table) in the trend archive. It is used only if the sSourceType parameter is se to "mssqlbackup", "accessbackup" or "dbasebackup".
sConnection[optional] (String) ADO Connection trend database connection string. If this parameter is set then the following parameters of the sSource parameter are not used: "server:xxx;", "database:xxx;", "user:xxx;" and "password:xxx;". These parameters are already contained in the ADO Connection string in the sConnection parameter.
Return Values:
Returns true if the archive was successfully opened, otherwise it returns false.
Note:
The method sets and opens trend archive (if it has not been created before then it creates one). If the archive was already opene before (when starting the application, by previous calling Open), the method closes the current archive first.

Read only (new records can't be written) configurator affects behaviour of Open method (see PmTrend object in "Read only (new records can't be written)" mode).

See also:
Example1:
Opening the table in the Access database created by the PmTrend object.
oTrend.Open "accesscyclic", "database:c:\trend1.mdb;table:history1;coltimename:pm_time;colattrname:pm_attr;"
  or
oTrend.Open "accesscyclic", "table:history1;coltimename:pm_time;colattrname:pm_attr;", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:/trend1.mdb;"
Example2:
Opening the table in the Access database data.mdb (created by another system externally). The time column in the table is called savetime. The "Read only (new records can't be written)" mode is enabled, i.e. the Read only (new records can't be written) configurator is set to true.
oTrend.Open "accesscyclic", "database:c:\data.mdb;table:pmctv;coltimename:savetime;colattrname:;"
  or
oTrend.Open "accesscyclic", "table:pmctv;coltimename:savetime;colattrname:;", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\data.mdb;"
Example3:
Opening the table in the MS SQL server (the table was also not created by the PROMOTIC system). The time column in the table is called savetime. The "Read only (new records can't be written)" mode is enabled, i.e. the Read only (new records can't be written) configurator is set to true.
oTrend.Open "mssqlcyclic", "server:.\MSSQLSERVER;user:pm_writer;password:pmwriter;database:pm_data;table:pmctv;coltimename:savetime;colattrname:;"
  or
oTrend.Open "mssqlcyclic", "table:pmctv;coltimename:savetime;colattrname:;", "Provider=SQLOLEDB;Server=.\MSSQLSERVER;Database=pm_data;Uid=pm_writer;Pwd=pmwriter;"
Example4:
Opening the binary data file, that has been created by the PmTrend Promotic object.
oTrend.Open "promoticcyclic", "table:c:\data.ht;"
Example5:
Opening the dBase format trend archive files in the application data folder, located in the trend\archive subfolder. The trend archive has been created by the PmTrend Promotic object and the filenames of the *.dbf tables begin with Trend prefix.
oTrend.Open "dbasebackup", "database:#data:/trend/archive;table:trend;backupcount:15;backupsizerows:500;backupsizetime:not limited;"
  or
oTrend.Open "dbasebackup", "table:trend;backupcount:15;backupsizerows:500;backupsizetime:not limited;", "Data Source=c:/trend/archive;"
Example6:
Opening individual dBase file in the application data folder, in the trend\archive subfolder. The file was created by the PROMOTIC PmTrend object.
Dim sSource
oTrend.Close
sSource = "table:#data:/trend/archive/trend2014-02-12_14-18-26.dbf;"
  or
sSource = "database:#data:/trend/archive;table:trend2014-02-12_14-18-26.dbf;"
oTrend.Open "dbasebackup",sSource
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice