Method: RaiseError for DataPlugin
- Updated2024-09-12
- 2 minute(s) read
DataPlugin > Methods > Method: RaiseError for DataPlugin
Method: RaiseError for DataPlugin
Aborts loading with an error message.
Object.RaiseError([ErrMsg])
| Object | DataPlugin Object with this method |
| [ErrMsg] | String Specifies the error message to be displayed. DIAdem displays this error message when loading. The DataFinder indexes the file with an index error (eIndexFailure). Do not specify an error message when the DataPlugin cannot load the file. DIAdem then generates an error message automatically and the DataFinder does not index the file. |
The following example shows the settings required for reading the lines listed below:
Begin Header¶ Name: XShift¶ Name: YShift¶ End Header¶ 0.162820 : 0.001234¶ 0.162821 : 0.002398¶ 0.162822 : 0.001296¶ 0.162823 : 0.001628¶ 0.162824 : 0.001683¶ 0.162825 : 0.008734¶
RaiseError aborts loading with an error message if the end of the header information is not found:
File.Formatter.LineFeeds = vbNewLine File.Formatter.Delimiters = ":" File.Formatter.TrimCharacters = " " Dim TagName, TagValue Dim ChNames() ReDim ChNames(1) TagName = File.GetNextStringValue(eString) File.SkipLine() If TagValue <>"Begin Header" Then Call RaiseError End If Do TagName = File.GetNextStringValue(eString) TagValue= File.GetNextStringValue(eString) File.SkipLine() If TagName = "Name" Then ChNames(UBound(ChNames)) = TagValue ReDim Preserve ChNames(UBound(ChNames)+1) End If Loop Until TagName = "End Header" Or IsEmpty(TagName) If IsEmpty(TagName) Then Call RaiseError("File corrupt or not xyz format.") End If Dim oGrp : Set oGrp = Root.ChannelGroups.Add("Measurements") Dim oBlock : Set oBlock = File.GetStringBlock() Dim i, oChn For i = 1 To UBound(ChNames)-1 Set oChn = oBlock.Channels.Add(ChannelNames(i), eR64) oGrp.Channels.AddDirectAccessChannel(oChn) Next