Save:
Fetch
Saving and fetching works, but..
When saving I get the 'Corrections fetching was successful' message.
When fetching I get 'Error #9, subscript out of range', while the fetch is done well...
Any ideas ?
Code:
Dim f, fs, file_path, file_name, file_name_path
On Error Resume Next
Set fs = CreateObject("filectl.filesystem")
Set f = CreateObject("filectl.file")
file_path= "\\PLC_102\CORRECTIES\"
file_name= CStr(SmartTags("ACTIVE BATCH.ORDER_DATABASE.ARTIKEL_NUMMER"))& ".csv"
file_name_path= file_path & file_name
If Err.Number <> 0 Then
ShowSystemAlarm "Error#" & CStr(Err.Number)&""& Err.Description
Err.Clear
Exit Sub
End If
If SmartTags("DB Ponsunit Data 300.Met_Zonder_Klemsysteem") Then
SmartTags("KlemValue")= 1
Else
SmartTags("KlemValue")= 0
End If
f.open (file_name_path), 2
f.Lineprint SmartTags("INSTELLING PONSUNIT.CORRECTIES.LINKS.ECS")
f.Lineprint SmartTags("INSTELLING PONSUNIT.CORRECTIES.LINKS.HOEK")
f.Lineprint SmartTags("INSTELLING PONSUNIT.CORRECTIES.LINKS.HOOGTE")
f.Lineprint SmartTags("INSTELLING PONSUNIT.CORRECTIES.RECHTS.ECS")
f.Lineprint SmartTags("INSTELLING PONSUNIT.CORRECTIES.RECHTS.HOEK")
f.Lineprint SmartTags("KlemValue")
f.Close
If Err.Number <> 0 Then
ShowSystemAlarm "Error#" & CStr(Err.Number)&""& Err.Description
Err.Clear
Exit Sub
End If
Set f = Nothing
Set fs = Nothing
ShowSystemAlarm "Corrections storage was successful"
Fetch
Code:
Dim f, fs, file_path, file_name, file_name_path, DataSet, HiField(4,4), i, j, y
On Error Resume Next
Set fs = CreateObject("filectl.filesystem")
Set f = CreateObject("filectl.file")
file_path= "\\PLC_102\CORRECTIES\"
file_name= CStr(SmartTags("ACTIVE BATCH.ORDER_DATABASE.ARTIKEL_NUMMER"))& ".csv"
file_name_path= file_path & file_name
If Err.Number <> 0 Then
ShowSystemAlarm "Error#" & CStr(Err.Number)&""& Err.Description
Err.Clear
Exit Sub
End If
If fs.dir(file_name_path)= "" Then
SmartTags("INSTELLING PONSUNIT.CORRECTIES.LINKS.ECS") = 0
SmartTags("INSTELLING PONSUNIT.CORRECTIES.LINKS.HOEK") = 0
SmartTags("INSTELLING PONSUNIT.CORRECTIES.LINKS.HOOGTE") = 0
SmartTags("INSTELLING PONSUNIT.CORRECTIES.RECHTS.ECS") = 0
SmartTags("INSTELLING PONSUNIT.CORRECTIES.RECHTS.HOEK") = 0
SmartTags("KlemValue") = 0
Else
f.open file_name_path, 1
For y = 0 To 5
i = 0
HiField(y,i) = f.LineInputString
Next
SmartTags("INSTELLING PONSUNIT.CORRECTIES.LINKS.ECS") = HiField(0,0)
SmartTags("INSTELLING PONSUNIT.CORRECTIES.LINKS.HOEK") = HiField(1,0)
SmartTags("INSTELLING PONSUNIT.CORRECTIES.LINKS.HOOGTE") = HiField(2,0)
SmartTags("INSTELLING PONSUNIT.CORRECTIES.RECHTS.ECS") = HiField(3,0)
SmartTags("INSTELLING PONSUNIT.CORRECTIES.RECHTS.HOEK") = HiField(4,0)
SmartTags("KlemValue") = HiField(5,0)
End If
If SmartTags("KlemValue")= 1 Then
SmartTags("DB Ponsunit Data 300.Met_Zonder_Klemsysteem")= True
Else
SmartTags("DB Ponsunit Data 300.Met_Zonder_Klemsysteem")= False
End If
If Err.Number <> 0 Then
ShowSystemAlarm "Error#" & CStr(Err.Number)&""& Err.Description
Err.Clear
Exit Sub
End If
f.close
Set f = Nothing
Set fs = Nothing
ShowSystemAlarm "Corrections fetching was successful"
Saving and fetching works, but..
When saving I get the 'Corrections fetching was successful' message.
When fetching I get 'Error #9, subscript out of range', while the fetch is done well...
Any ideas ?