RSVIEW32 dbf file using VB

bigbuckaroo

Member
Join Date
Apr 2009
Location
Wisconsin
Posts
114
Greetings all,I have an existing RSVIEW32 project that is running on a computer which is connected to our "production network". The production network is on a xxx.xxx.3.xxx address and the rest of the company network is on a .1. The production server computer has 2 NIC cards so both networks are connected to it. Due to IT issues and the like they are making this little issue I want to accomplish much more difficult. I want to be able to copy some data log files to my desktop computer on the .1 network automatically. On the production server computer there is Microsoft Outlook available but not Excel so what I was thinking was to use VB to copy a datalog file to Outlook and then email it to myself at my desktop. From there I would use Excel to manipulate it etc. I know very little about VB so I was wondering if anyone can point me in the right direction.Any help would be greatly appreciated.If any more information is needed please let me know and I will do my best to provide it.ThanksTom
 
Because the file would probably be open copying it is not a good idea.
A better way is to log the data to an MDB file (Access) RSV can do this.
Then on your own network computer use excel (providing VBA is installed in the options) you can do an automated spreadsheet to get the data a simple way to see the code is:
open a clean book, start recording a macro, then get external data, select the MDB file over the network (assume IT give you access to it), import the data, then paste it onto the sheet, save the macro, goto VB (tools\Macro\VB) then look at the code.
or if you want to import all data then just use the macro.
I have written many automated spreadsheets that use a calendar to select dates/times then import the data & format it into graphs on the spreadsheet.
This is a quick one
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 20/09/2010 by len
'

'
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=MYScada;UID=MYDB;Trusted_Connection=Yes;APP=Microsoft® Query;WSID=LEN_HOME;DATABASE=MYScada;" _
, Destination:=Range("A1"))
.CommandText = Array( _
"SELECT FIXALARMS.ALM_TAGNAME, FIXALARMS.ALM_TAGDESC, FIXALARMS.ALM_VALUE, FIXALARMS.ALM_DESCR, FIXALARMS.ALM_ALMAREA, FIXALARMS.ALM_OPNAME, FIXALARMS.ALM_OPFULLNAME, FIXALARMS.ALM_DATELAST, FIXALARMS." _
, _
"ALM_TIMELAST, FIXALARMS.ALM_DTLAST" & Chr(13) & "" & Chr(10) & "FROM MYScada.dbo.FIXALARMS FIXALARMS" & Chr(13) & "" & Chr(10) & "WHERE (FIXALARMS.ALM_DATELAST>'30/07/06' And FIXALARMS.ALM_DATELAST<'29/01/07')" & Chr(13) & "" & Chr(10) & "ORDER BY FIXALARMS.ALM_DATELAST" _
)
.Name = "Query from MYScada"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
End Sub
As you can see the macro was recorded by returning the data between dates, you could include this macro in code that selects dates from a date picker, then format it into variables, replace the date bits in the query with the variables.
 
(assume IT give you access to it), This is where the big issues is I believe. There is no access to the production server computer from the company network. This is right from the IT person. That is why I am trying to use Outlook which is on the production server computer to send the file to myself. I have tried to use Excel which is on my desktop to import the data from RSVIEW 32 project but either I am not doing it correctly (very possible) or it can not be done as IT says it can't (probable). As for copying the file, I don't think it is open. The datalog model is creating a file in a certain folder every night. Nothing else is being done with it right now.Thanks for your help.
 
Depending what kind of analysis you want to perform, you might consider leaving the data on the production PC. You can use VBA inside the RSView project to read and manipulate data from the data or alarm log files.

See my post here for some example code.

In the first example, I'm extracting a range of tag values from a data log and calculating the standard deviation.

In the second example, I'm creating a list containing distinct incoming alarms along with the number of times each alarm has occurred.

I store the results of both of these functions into regular RSView tags for easy display for the operators.


-Trevor
 
Yes it would be nice if I could do everything on this Production Server computer. However it is supposed to be remote from all other computers. I log in to it to modify the project etc. but otherwise no one else access it. Therefor unless I am missing something which could very well be, I have to find a way to move a copy of the file to Microsoft Outlook using the VBA inside RSVIEW 32. I currently have a couple of VBA subroutines executing an alarm email to some people as an alarm occurs. Now i want to email the alarm file to myself at the end of the night.Thanks for all the help so far.
 
I don't really see a problem all our Scada's are xx.xx.8.xx
Our Company Pc's are xx.xx.5.xx, there should not be any reason why you should not have access if you already work on the server & if you have two network cards etc..., automated spreadsheets if protected are quite safe all the vb does is run a query if you store the datalog on say another partition & IT allow you read access to it.
I currently have 4 Scada systems running on the plant, I can access all these via pc anywhere, and we have two types of reporting system, one is done in .net & uses I.E. to generate reports & the other automated spreadsheets to query the SQL or Access Db's, these DB's also contain closely guarded recipe information but this is not accessable via the reports.
All pc users on the plant have access to these but not PCA.
Appart from that all alarms are sent via email to a group set up in outlook, these alarms are automatically sent to persons in that group & are stored in an alarm folder in outlook.
 
Yes I understand where you are coming from and it's nice that you have everything just the way you want. However, I do not have that luxury. I am trying to find a solution within the confines of what I have not what others think it should be. I really am thankful for the replies. Again I am very inexperienced at using VBA but so far I have a small program that copies the datalog file to another location. What I am having issues with is taking that file and inserting it as an attachment to an email. I keep getting an error that it is READ ONLY. If it makes any difference I am using the program OUTLOOK REDEMPTION to bypass the security features of Outlook since it was blocking the third party software(RSVIEW32) from sending an email. Again thanks for all the help
 

Similar Topics

Hi, I have same system connected to 2 PC's running RSView32 SE (old)and another with Factorytalk SE (new). I next few months old one will be...
Replies
2
Views
1,515
I have to produce charts for a month's worth of these dbf files. There is one file for each 6 hour cycle. Anyone have any ideas? I could...
Replies
4
Views
1,931
Hi, I would like to create a vba code to format the dbf files that RSView32 creates to make readable reports. For example, if I datalog a tag, I...
Replies
17
Views
12,503
I'm importing an RSView32 project into FTView SE. I'm using Legacy Tag Database Conversion on a virtual machine with Windows XP, I did the first...
Replies
0
Views
377
Hi everybody, I have a rsview32 application, when I try to run it it loads upto 80% system settings and the crashes saying Rsview32 Project...
Replies
3
Views
1,914
Back
Top Bottom