ni.com is currently experiencing issues.
Support teams are actively working on the resolution.
ni.com is currently experiencing issues.
Support teams are actively working on the resolution.
11-30-2016 10:44 AM
Hello,
I'll start with explaining what I want to do. I have to deal with a large number of file formats, that are all very different, and have their own dataplugin. I want to remove the step of having to use "Open with..." and then selecting the appropriate dataplugin, when the different files have to be loaded. To do this, I am modifying the code in each dataplugin to check that the file being loaded meets a certain condition unique to the appropriate file, or else an error is raised and DIAdem moves onto the next dataplugin.
I am having issues simply checking the first available string in the file. Currently, I have:
1. If File.GetNextStringValue(eString) <> "time" Then Call RaiseError("This dataplugin does not work with this file.") 2. saChanNames = Split(File.GetNextLine,File.Formatter.Delimiters) 3. saChanDataType = Split(File.GetNextLine,File.Formatter.Delimiters) 4. Set Block = File.GetStringBlock()
The problem with this is that because I'm using "GetNextStringValue", and the check works, when I get to line 2 the string "time" is not added to the array. Is there any way to check for "time" without progressing my position in the file, or is there a way to move back to the beginning after I use "GetNextStringValue"?
Thanks.
Solved! Go to Solution.
12-01-2016 01:12 AM
dim currPos : currPos = File.Position If File.GetNextStringValue(eString) <> "time" Then Call RaiseError() File.Position = currPos
You can use the Position property of the file to set it back to origin location.
Please make sure that you call RaiseError without parameters to signal that it is not your file.
12-01-2016 01:30 AM
In addition to AndreasK answer, please use the RaiseError command without any parameter:
If File.GetNextStringValue(eString) <> "time" Then Call RaiseError
This will express exactly what you described, the DataPlugin will return that it does not address the content of this file instead of an error.
Also, when indexed by DataFinder, there will be no error status, but the index status will be "eIndexedNotMyFile".
12-01-2016 12:32 PM
That's exactly the kind of idea I needed. Thanks.