Promotic

Open - method of the PmaTrendGroup object

Description:
Open or create new trend archive and access its data.
Syntax:
Boolean Open(String sSourceType, String sSource, [String sConnection])
Parameters:
sSourceType(String) Specifies 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 PmaTrendGroup object is connected. Entries are in the KeyVal format, for example "database:c:\database.mdb;table:data;".
"server:xxx;" (optional) - (is ignored if the sConnection parameter is defined) 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) - (is ignored if the sConnection parameter is defined) 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) - (is ignored if the sConnection parameter is defined) The user password for the access to the SQL server. Not specified if the sSourceType parameter is set to "accesscyclic", "accessbackup", "dbasebackup" or "promoticcyclic".
"database:xxx;" (optional) - (is ignored if the sConnection parameter is defined) The database for data storage is defined here. If the sSourceType parameter is:
"mssqlcyclic", "oraclecyclic", "mysqlcyclic", "firebirdcyclic", "mssqlbackup": specifies the SQL database.
"dbasebackup": specifies the *.dbf files folder.
"accesscyclic", "accessbackup": specifies the *.mdb file.
"promoticcyclic": specifies the *.ht file folder.
"table:xxx;" (optional) - Specifies the table or table prefix where the data is stored. If the sSourceType parameter is:
"mssqlcyclic", "oraclecyclic", "mysqlcyclic", "firebirdcyclic", "accesscyclic": specifies the table name with cyclic data.
"dbasebackup": specifies the prefix (first part) of the backup names (tables in the database), the complete name consists of this prefix followed by the date with time. If the complete *.dbf file name 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 file name including the path (folder). Then the path is not entered in the "database:" parameter. The complete path can be entered also in the form #data:.
"mssqlbackup", "accessbackup": specifies the prefix (first part) of the backup names (tables in the database), the complete name consists of this prefix followed by the date with time or serial number.
"promoticcyclic": specifies the *.ht cyclic file name (can be entered with the extension). Note! Is is also possible to enter the comlete *.ht file name including the path (folder). Then the path is not entered in the "database:" parameter. The complete path can be entered also in the form #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 on setting the sSourceType 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 if the database table is accessed that was created by archiving the data by the PmaTrendGroup object, otherwise this parameter is set empty. The parameter cannot be set on setting the sSourceType to "mssqlbackup", "accessbackup", "dbasebackup" or "promoticcyclic".
Caution! If the database table is being opened, that is not created by the PmaTrendGroup 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) - Specifies 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) - Specifies the size - number of rows - of one backup (table) in the trend archive. It is used only if the sSourceType parameter is set to "mssqlbackup", "accessbackup" or "dbasebackup".
"backupsizetime:xxx;" (optional) - Specifies the time span of one backup (table) in the trend archive. It is used only if the sSourceType parameter is set 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 value:
Returns the true value if the archive was successfully opened, otherwise returns the false value.
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 (after the application is launched, by previous calling the Open method), then the method closes the current archive first.
The "Read only (new records cannot be written)" configurator affects behavior of the Open method (see The PmaTrendGroup object in "Read only (new records cannot be written)" mode).
See also:
Example1:
Open the table in the Access database created by the PmaTrendGroup object.
JavaScriptVBScriptSelect and copy to clipboard

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:
Open 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 cannot be written)" mode is enabled, i.e. the "Read only (new records cannot be written)" configurator is set to true.
JavaScriptVBScriptSelect and copy to clipboard

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:
Open the table in the MS SQL database (the table was also not created by the PROMOTIC system). The time column in the table is called savetime. The "Read only (new records cannot be written)" mode is enabled, i.e. the "Read only (new records cannot be written)" configurator is set to true.
JavaScriptVBScriptSelect and copy to clipboard

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:
Open the binary data file, that has been created by the PmaTrendGroup object.
JavaScriptVBScriptSelect and copy to clipboard

oTrend.Open("promoticcyclic", "table:c:\\data.ht;");
Example5:
Open trend archive files in the dBase format in the #data: folder (in the trend\archive subfolder).
The trend archive has been created by the PmaTrendGroup object and the filenames of the *.dbf tables begin with Trend prefix.
JavaScriptVBScriptSelect and copy to clipboard

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:
Open individual dBase file in the #data: folder (in the trend\archive subfolder).
The file was created by the PmaTrendGroup object.
JavaScriptVBScriptSelect and copy to clipboard

var sSource;
oTrend.Close();
sSource = "table:#data:/trend/archive/trend2018-02-12_14-18-26;";
// or
sSource = "database:#data:/trend/archive;table:trend2018-02-12_14-18-26;";
oTrend.Open("dbasebackup", sSource);
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.