Promotic
WikipediaLinkedInYoutubeTwitterFacebook

SaveCfg - method of object TrendsView

Description:
Saving current configuration data of viewer
Syntax:
SaveCfg(sCfg As String, nStyle As Long, sFilter As String) As Boolean
Calling:
oTView.SaveCfg sCfg, nStyle, sFilter
Parameters:
sCfg(String) Location for saving the configuration data. It is either:
"input:" - Selection from a list. Before saving the list of existing configurations is displayed. This allows to select existing file or create new.
- If the trend viewer runs in local panel on the server:

The configuratio list is read from the folder defined after the "input:" text. The selected file will be saved there..

- If the trend viewer runs in WEB browser:

The configurations list is read from the temporary storage of the WEB browser. The selected file is saved into this temporary storage. In such case, the string defined after the "input:" text is ignored.

Example: "input:#cfg:", see Example1.

"file:" - File on disc. The configuration data will be saved into the specified file, that is defined after the "file:" text.
- If the trend viewer runs in local panel on the server:

The file name is displayed including the complete file path..

- If the trend viewer runs in WEB browser:

This option is currently not functional for WEB browsers.

Example: "file:#cfg:config.tg", see Example2.

"string:" - Text string. In this case, the parameter is of the input/output type and the output contains the specified configuration data - a XML formatted text.

The "string:" value is obsolete and it is better to use the GetCfg method.

nStyle(Long) Specifies how the data have to be saved.
0 - Save always.
1 - If the file exists, then a question is displayed whether the existing file to overwrite (if the answer NO is entered, the configuration is not saved).
2 - If the file exists, the configuration is not saved.
sFilter(String) Specifies which of the viewer properties are saved into the configuration data.

The individual values can be concatenated. Example: "View;Trends;TimeMinMax;".

"View;" - Save the viewer appearance apart the tvTrend objects and apart the time of the left and right edge of the viewer.
"Trends;" - Save only the configuration of the tvTrend objects without data points
"TrendsNoConnect;" - Save only the configuration of the tvTrend objects without data points and parameters of the connection. The parameters of the connection are specified by the ConnectionType, ConnectionServer, ConnectionGroup and ConnectionItem properties of the tvTrend object. This option is suitable for generating the configuration file for printing. Note! If some of the following trend properties (for example tvTrend.Name, tvTrend.Unit, tvTrend.ValueMin, tvTrend.ValueMax or tvGraph.Color), contains the string $default (indicating reading the value from the server), then the string will be replaced by the real value that was read (cannot be read without the connection).
"TrendsData;" - Save only data points currently read by the viewer of the tvTrend object without the configuration of this object. This option is suitable for generating the configuration file for printing.
"TimeMinMax;" - Save the time of the left and right edge of the viewer.
"TimeZoom;" - Save only the length of viewer time axis.
Return Values:
The method returns the success rate of saving. The value false means failed saving.
Note:
The configuration data are saved in the XML format and consequentially they can be modified by any text editor and read backwards into the viewer by the LoadCfg method.
 
This method saves the configuration always on the computer where the trends are being viewed. I.e. if the trend viewer runs on the client (WEB browsers InternetExplorer, Firefox, Chrome ..), then the configutarion is saved into the temporary storage of such browser and therefore are not accessible by other clients. This method cannot save configurations on the server because there are no limiting mechanisms for user testing (to prevent someone from saving to the server).

The GetCfg method is designed for saving configurations to the server.

Example1:
Before saving a list of existing configurations is displayed. It is possible to select an existing file or create new. Only the configuration of objects tvTrend displayed in the viewer are saved.
oTView.SaveCfg "input:#cfg:", 1, "Trends;"
Example2:
Saving into the file on disc. Only the configuration of objects tvTrend displayed in the viewer are saved.
oTView.SaveCfg "file:#cfg:mycfg.tg", 0, "Trends;"
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice