03-31-2006 08:02 PM
04-03-2006 08:27 AM
Hi Steve,
I'm not sure based on your description whether the delimiters are always as you describe them or whether you mean that they can be a random combination of delimiters. If they can be a random combination of delimiters then you'll probably have to parse each string, but the DataPlugin API can help you. Use GetNextStringValue(eR64) and then check with IsNull in this case. (If this is the case let me know and I'll try to provide a more complete description.)
If they are exactly as you describe them, then the solution is easier; you can use the direct access channels. First set up formatting information like this:
File.Formatter.Delimiters = vbTab & "," 'Tab and comma are both delimiters.
File.Formatter.TrimCharacters = " " 'Since that space is never alone just trim it.
Then create channels in the block for all of the positions between the delimiters, but you don't add the space-holder channels to the group. In the example you described above this would look roughly like this:
Dim Block : Set Block = File.GetStringBlock()
Dim DirectAccessChannel : Set DirectAccessChannel = Block.Channels.Add("FileData1", eR64)
ChannelGroup.Channels.AddDirectAccessChannel(DirectAccessChannel)
Set DirectAccessChannel = Block.Channels.Add("FileData2", eR64)
'ChannelGroup.Channels.AddDirectAccessChannel(DirectAccessChannel)
Set DirectAccessChannel = Block.Channels.Add("FileData3", eR64)
ChannelGroup.Channels.AddDirectAccessChannel(DirectAccessChannel)
Set DirectAccessChannel = Block.Channels.Add("FileData4", eR64)
'ChannelGroup.Channels.AddDirectAccessChannel(DirectAccessChannel)
Set DirectAccessChannel = Block.Channels.Add("FileData5", eR64)
ChannelGroup.Channels.AddDirectAccessChannel(DirectAccessChannel)
Set DirectAccessChannel = Block.Channels.Add("FileData6", eR64)
'ChannelGroup.Channels.AddDirectAccessChannel(DirectAccessChannel)
Set DirectAccessChannel = Block.Channels.Add("FileData7", eR64)
ChannelGroup.Channels.AddDirectAccessChannel(DirectAccessChannel)
Set DirectAccessChannel = Block.Channels.Add("FileData8", eR64)
ChannelGroup.Channels.AddDirectAccessChannel(DirectAccessChannel)
Set DirectAccessChannel = Block.Channels.Add("FileData9", eR64)
ChannelGroup.Channels.AddDirectAccessChannel(DirectAccessChannel)
Hope that helps,
Myrle
04-10-2006 02:09 PM
Hello Myrle,
Thank you for the solution. It works! Rather unusual way of handling the double tabs by creating a direct access channel for the tab data but not adding it to the data portal.I'll have to remember that.
Steve