RSviewSE Datalog in Txt or Csv

AndrewB

Member
Join Date
Aug 2003
Posts
165
Can anyone help me? (more stupid rsview q)

I need to datalog 12 tags from RSviewSE cpr7 to TXT or CSV.
Obviously i need to use ODBC. I've been trying to use the txt driver in ODBC with out any success. (cant create any tables)

I am obviously missing something, can anyone give me a heads up as i have nfi.

I can happily log to Access or fileset... I just need to get this one out in txt/csv
 
I don't use RSViewSE, but in RSView32, I use the internal Visual Basic program to write a VB program that: (1) sets up the CSV data log location on a hard drive, (2) selects the tags to be logged, (3) writes the CSV data file at an interval determined by an action in the EVE (Events) internal RSView program.

Here is an example that logs 4 tags to a file named "Hot Gas mmddyy", with the date changing at midnight.

Public Sub WriteCSVLogFile()

Dim AIT240 As Tag
Dim FUELLOGTOTAL As Tag
Dim RECIPE_START As Tag
Dim SYSTEMRUN As Tag
Dim LogDate As Date
Dim LogFile As Integer
Dim HeaderTrack As Integer
Dim HeaderPrint As Integer

On Error GoTo catch
MkDir ("C:\HOT_GAS_LOG")

Check:
'Check to see if the header needs to be inserted.
'HeaderTrack is an Integer bit that is set to 0 if it is 12:00 AM, otherwise set = 1.
If ((Format$(Time, "hh:mm:ss") >= #12:00:00 AM#) And (Format$(Time, "hh:mm:ss") <= #12:01:00 AM#)) Or (HeaderPrint = 0) Then
HeaderTrack = 1
Else: HeaderTrack = 0
End If

Set AIT240 = gProject.TagDb("AIT240_SCALED")
Set FUELLOGTOTAL = gProject.TagDb("FUELLOG_TOTAL")
Set RECIPESTART = gProject.TagDb("RECIPE_START_PB")
Set SYSTEMRUN = gProject.TagDb("SYSTEM_RUN")

'Set LogDate equal to current date function.
LogDate = Date

'Get available file number
LogFile = FreeFile

'Open File for writing to and name file with format date.csv
Open "C:\HOT_GAS_LOG\" & Format$(LogDate, "mmddyy") & ".csv" For Append As #LogFile

'Insert the Header into the csv file between 12:00 and 12:01 AM (or next time program runs) and then insert the data in the correct columns.
If HeaderTrack = 1 Then
Print #LogFile, " TIME"; ","; _
"AIT-240_NOX"; ","; _
"TOTAL FUEL USED"; ","; _
"RECIPE ON/OFF"; ","; _
"SYSTEM_ON/OFF"; ","; _

'Insert data into column if the header was just inserted
Print #LogFile, Format$(Time, "hh:mm:ss"); ","; _
Format(AIT240.Value, "###0"); ","; _
Format(FUELLOGTOTAL.Value, "#######0"); ","; _
Format(RECIPESTART.Value, "#0"); ","; _
Format(SYSTEMRUN.Value, "#0"); ","; _

HeaderPrint = 1
Else
'If time is anything other than 12:00 and 12:01 midnight just insert the data
Print #LogFile, Format$(Time, "hh:mm:ss"); ","; _
Format(AIT240.Value, "###0"); ","; _
Format(FUELLOGTOTAL.Value, "#######0"); ","; _
Format(RECIPESTART.Value, "#0"); ","; _
Format(SYSTEMRUN.Value, "#0"); ","; _

End If
Close #LogFile
'If the directory already exists, skip to the next line
'Error 75 is directory already created or exists.
catch: 'Error handling routine
If Err.Number = 75 Then
Err.Clear
GoTo Check
Else:
If Err.Number = 4170 Then
Print "Error#4170--Communications driver is not available."
'roErrorTagEvent (4170) - an error occurred while waiting for the operation to complete
Err.Clear
GoTo Check
End If 'End errror #4170
Err.Clear
End If 'End errror handling
End Sub
 

Similar Topics

I'm working on a system that has a RSViewSE vers.4 project upgraded to FactoryTalk ViewSE vers.7 I can't open the vers.4 project, I can only see...
Replies
10
Views
2,323
I need some reporting software for an Allen Bradley HMI RS View SE to be able to create the production tables and charts. I am using Factory Talk...
Replies
4
Views
5,038
I'm a new developer (for RSVIEW... been developing software in other languages for about 15 years), and have taken the AB classes... but I'm in a...
Replies
6
Views
4,448
Hi everybody I got one panelview 1000 plus running, my client want to transfer same application from panelview to a PC, same time they want...
Replies
3
Views
2,089
Greetings, In RSViewSE (Factory Talk View), is there a way to just use the default Windows theme for displays? What I mean is that I don't want...
Replies
3
Views
1,814
Back
Top Bottom