Promotic
WikipediaLinkedInYoutubeTwitterFacebook

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 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": 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:
"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 the database) is defined here, the complete name consists of this prefix followed by the date/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": the prefix (first part) of the backup names (tables in the database) is defined here, the complete name consists of this prefix followed by the date/time or serial number.
"promoticcyclic": the *.ht cyclic file name is defined here (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 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 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 entered if the sSourceType is set to "mssqlbackup", "accessbackup", "dbasebackup" or "promoticcyclic".

Caution! If the a 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 lines - 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 values:
Returns true if the archive was successfully opened, otherwise 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 (after starting the application, by previous calling the Open method), then the method closes the current archive first.

The "Read only (new records cannot be written)" configurator affects behaviour 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 the dBase format trend archive files 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.14 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice