RSView32 report

ypf_108

Member
Join Date
Jul 2009
Location
china
Posts
160
I would like to use prepared statements rsview32 7.20, the data once a day, 7:00 transformations, namely, early shift, middle shift, night shift production, reporting requirements have query functions, and can save the Excel spreadsheet. I would not VB, invited a friend from afar made me a case on this project, thank you
Configuration is as follows: rsvew32 7.20 rslogix5000 v15 rslinx2.43
 
It is not really clear to me what it is you want to do.
So I will suggest something that might help

In RSView 32 under the project tree there is an events file that can be set to trigger at an event and time of day can be set up as that event.
 
Simply put, that is, I would like to use RSVIEW32 the preparation of reports, queries and derived statements are required EXCEL spreadsheet functions. Data collected from CONTROLLOGIX5561.
 
Log your data to an MDB database as set up in the log, log some data, open a spreadsheet, start a macro in excel, get external data when you configure the query select a start date & an end date then get data, save the macro this will save the macro as VB code, you can then look at the code & modify the sql statement by substituting the fixed datetime fields with variables.
Below is a sample of a mdified macro
temp = Format(Calendar1.Value, "yyyy-mm-dd")
temp = temp + " 17:50:00"
temp1 = Format(Calendar1.Value, "yyyy-mm-dd")
temp1 = temp1 + " 18:00:00"
Sheets("Sheet2").Select
With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _
"ODBC;DSN=MS Access 97 Database;DBQ=\\PC0264\SCADA LOG\Logged Data\LineCount.mdb;DefaultDir=\\PC0264\SCADA LOG\Logged Data;DriverId=2" _
), Array("81;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;")), Destination:= _
Range("A1"))
.Sql = Array( _
"SELECT FloatTable.DateAndTime, FloatTable.TagIndex, FloatTable.Val" & Chr(13) & "" & Chr(10) & "FROM `\\PC0264\SCADA LOG\Logged Data\LineCount`.FloatTable FloatTable" & Chr(13) & "" & Chr(10) & "WHERE (FloatTable.DateAndTime>= #" & temp & "# And" _
, _
" FloatTable.DateAndTime<= #" & temp1 & "#)" & Chr(13) & "" & Chr(10) & "ORDER BY FloatTable.TagIndex" _
)
.FieldNames = True
.RefreshStyle = xlInsertDeleteCells
.RowNumbers = False
.FillAdjacentFormulas = False
.RefreshOnFileOpen = False
.HasAutoFormat = True
.BackgroundQuery = True
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.SavePassword = False
.SaveData = True
End With
 
Log your data to an MDB database as set up in the log, log some data, open a spreadsheet, start a macro in excel, get external data when you configure the query select a start date & an end date then get data, save the macro this will save the macro as VB code, you can then look at the code & modify the sql statement by substituting the fixed datetime fields with variables.
Below is a sample of a mdified macro
temp = Format(Calendar1.Value, "yyyy-mm-dd")
temp = temp + " 17:50:00"
temp1 = Format(Calendar1.Value, "yyyy-mm-dd")
temp1 = temp1 + " 18:00:00"
Sheets("Sheet2").Select
With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _
"ODBC;DSN=MS Access 97 Database;DBQ=\\PC0264\SCADA LOG\Logged Data\LineCount.mdb;DefaultDir=\\PC0264\SCADA LOG\Logged Data;DriverId=2" _
), Array("81;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;")), Destination:= _
Range("A1"))
.Sql = Array( _
"SELECT FloatTable.DateAndTime, FloatTable.TagIndex, FloatTable.Val" & Chr(13) & "" & Chr(10) & "FROM `\\PC0264\SCADA LOG\Logged Data\LineCount`.FloatTable FloatTable" & Chr(13) & "" & Chr(10) & "WHERE (FloatTable.DateAndTime>= #" & temp & "# And" _
, _
" FloatTable.DateAndTime<= #" & temp1 & "#)" & Chr(13) & "" & Chr(10) & "ORDER BY FloatTable.TagIndex" _
)
.FieldNames = True
.RefreshStyle = xlInsertDeleteCells
.RowNumbers = False
.FillAdjacentFormulas = False
.RefreshOnFileOpen = False
.HasAutoFormat = True
.BackgroundQuery = True
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.SavePassword = False
.SaveData = True
End With
 
Thank you very much good repair, but I do not understand what you said, if you can post a question about my project, the better. I will try.
 
open up excel, select say sheet 2 goto tools then select macro then record new macro then save macro, then goto data get external data new database query then browse for the db you have in RSV, select the fields required,press next, then you can sort the data(choose just a few by datetime >= to and <= to sort by xxx then return data to excel then stop recording the macro.
goto tools select visualbasic, select module 1 this will contain the code as recorded, you can copy the code into a form like a popup then change the date/time fields with variables (note: keep the format correct) the variables to change are in red you will need to create a window in excel that contains say a date picker be careful when adding variables & the kind of data in the variable it has to be exact format for the query to work
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 25/03/2010 by len
'

'
Application.WindowState = xlMinimized
Application.WindowState = xlNormal
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=myScada;UID=BCHRMS;Trusted_Connection=Yes;APP=Microsoft® Query;WSID=LEN_HOME;DATABASE=myScada;" _
, Destination:=Range("A1"))
.CommandText = Array( _
"SELECT FIXALARMS.ALM_TAGNAME, FIXALARMS.ALM_VALUE, FIXALARMS.ALM_DESCR, FIXALARMS.ALM_ALMAREA, FIXALARMS.ALM_DATELAST, FIXALARMS.ALM_TIMELAST, FIXALARMS.ALM_DTLAST" & Chr(13) & "" & Chr(10) & "FROM BCHScada.dbo.FIXALARMS FIXALAR" _
, _
"MS" & Chr(13) & "" & Chr(10) & "WHERE (FIXALARMS.ALM_DATELAST>='26/06/06' And FIXALARMS.ALM_DATELAST<='26/12/06')" & Chr(13) & "" & Chr(10) & "ORDER BY FIXALARMS.ALM_TAGNAME" _
)
.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
 

Similar Topics

Hello,I have a problem about Rsview32 report, which had been discussed in this forum ,but I am a beginner about VBA report.I have a program,it...
Replies
0
Views
3,541
Hello,I have a problem about Rsview32 report, which had been discussed in this forum ,but I am a beginner about VBA report.I have a program,it...
Replies
0
Views
4,847
Does anybody have an example of a macro or VBA that will automatically produce and save a report file from RSView32? I have a panel mounted...
Replies
5
Views
5,471
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,498
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
373
Back
Top Bottom