10-18-2016 02:42 AM
I want to automatically load many R32-files into the data base, there is no DAT-file containing the structure, it must be created. Currently my script gets a file list an then a loop generates a header for each file and reads it. The structures are beeing set correctly, the first file is read out correctly, but after that the channel data of each following file is empty/filled with nearby zeros.
If I read out each single file, the data is correct. There is a new function DataFileLoadSel but it can't read binary data files.
I think the indexing is proper. I have no idea why rereading doesn't work, any suggestions?
Code:
do while (numLoop > 0)
Call HDDelAll()
GHDChnNo = DynChannelNo
GHDChnLength = ChannelLength
GHDChnType = "EXPLICIT"
GHDDispFormat= "Numeric"
GHDChnFile = chnFile
GHDSaveType = "BLOCK"
GHDChnIdx = 1
GHDChnMode = "REAL32"
Call HDCreate()
Call GroupNameChk("EMB-BKV-Data-"&(numFile+1)) '... GroupCreateName
Call GroupCreate("EMB-BKV-Data-"&(numFile+1),numFile+1,0) '...
Call GroupDefaultSet(numFile+1) '... TargetGroupIndex
Call DataLoadSel(chnFile,"1-",0) '... DataFile,ChnNoStr,IncludeHdLoad
...
loop
...
Solved! Go to Solution.
10-18-2016 04:40 AM
I found the mistake: ChannelLength is not equal for each file, it has to be calculated first.
'get file length
retVal = filesize(chnFile)
ChannelLength = round(retVal / (sizeOfFloat * DynChannelNo))
if (ChannelLength * sizeOfFloat * DynChannelNo) <> retVal then 'error handling