Over my head and I need help, RSView and VBA

geniusintraining

Lifetime Supporting Member + Moderator
Join Date
Jun 2005
Location
SC
Posts
8,242
I am kind of over my head with this and need help, its a VBA application in RSView32, the program opens a historical trend screen, first it opens the datalog on the network then we can choose what date we want to open, I have them starting a new file at midnight, every night.

It all works fine, open the network stored files, runs the application, I just want to change the screen views.

What I need to do is edit the default screen its not a GFX, I think its created by the VBA program (that I have butchered up) but I think its opens a TrendX screen? can you edit the TrendX screens? I need the file to open with a 24hr view and I want to change the tag range y-axis to a set range

I have attached the VBA in a txt format

Thank you very much :)
 
That's 470 lines of code! Are you sure there isn't an easier (builtin) way to create the trend screens, then write a simple script to change the date range and scaling? That couldn't be too uncommon/difficult a request. Am I missing something?
 
Yes, trending is easy, but this code gets the data from the server opens a screen that the person can choose the history from (2 years back) and then opens that file in a trending screen... it works very good

I just need to edit the screen, but I think i'm SOL... I can't find anything that will edit the screen or where its at

I think it may be trendx is a default, but I'll keep looking
 
Do the docs have a trendX object model in the reference section? Where did you find the functions and properties that you used?

'Configure model setup
.Description = "Wide model created from RSView32 object model"
.StorageFormat = roStorageFormatDBaseIVNarrow
'.DBaseLogMillisecondInSeparateField = False
Out of curiosity, what is the default date selection?
 
I think that your VBA program uses the Trend model inside RSView32. It appears this routine sets up two models, "RSVIEW" (wide format) and "RSVIEWNET" (narrow). The only options I see are for "Narrow" or "Wide" format, to change the logigng path, pick the tag names, set maximum number of files saved, and set the trending interval. The section of code below creates the Narrow model. Using this routine, I don't know how you could edit the screen. You would probably have to write your own trending program from scratch.

'Create a datalog model object
Set oModelNet = gDataLog.DataLogModels("RSVIEWNET")
'Configure the model
With oModelNet.DataLogModelCfg

.ResetToDefault

'Configure model setup
.Description = "Wide model created from RSView32 object model"
.StorageFormat = roStorageFormatDBaseIVNarrow
'.DBaseLogMillisecondInSeparateField = False

'Configure logging paths
.DBasePrimaryPathType = roPathTypeAbsolutePath
.DBasePrimaryPath = "C:\RSView\H-Press\RSViewNet"

'Configure file management
.DBaseStartNewFiles = roStartNewFilesOnEvent
.DBaseOnEventExpression = "prog\AutoStart"
.DBaseDeleteOldestFilesAfterMaxFilesEnabled = True
.DBaseMaxFilesBeforeDelete = 200

'Configure log triggers
.TriggerType = roTriggerTypePeriodic
.PeriodicInterval = 5
.PeriodicIntervalUnit = roIntervalUnitMinutes

'Configure tags in model
If sCommand1 <> "" Then
.TagsInModel.Add sCommand1
End If
.
. (continues)
.
 
Last edited:
Ok... Did some more digging and this is what I found

I know that some of you already know this, so this is a dumb down version (that people like 'I' can understand)

it may help someone some day or save them some time

this is the code that the TrendX uses for the object, so in short...
  • UserForm1 is doing this
  • Under 'object browser' double click the TrendX1_ChartModeChanged
  • This will open another user code for TrendX you can change the default settings there
Code:
Private Sub CommandButton8_Click()
	RSTrendX1.PrintChart 0, 0
End Sub
Private Sub CommandButton9_Click()
gCommand.Execute "DeleteHistory"
End Sub
Private Sub RSTrendX1_ChartModeChanged(ByVal NewMode As Long)
End Sub 
Private Sub UserForm_Activate()
	Dim UserName As Tag
	Set UserName = gTagDb.GetTag("system\user")
	If UserName = "ENGINEER" Then
		 CommandButton9.Visible = True
	Else: CommandButton9.Visible = False
	End If
	RSTrendX1.LoadTemplate (gProject.Path & "\3-hour.tem")//[b][color=red]<--- this is the default that I needed to change[/b]
[b][/color][/b]	'RSTrendX1.LoadTemplate (gProject.Path & "\non-isolated.tem")
	RSTrendX1.LoadTemplate (gProject.Path & "\Line.tem")
	'Label1.Caption = UserName
	End Sub
Private Sub UserForm_Initialize()
	History.Show
End Sub
Private Sub CommandButton1_Click()
	RSTrendX1.LoadTemplate (gProject.Path & "\4-hour.tem")
End Sub
Private Sub CommandButton2_Click()
	RSTrendX1.LoadTemplate (gProject.Path & "\6-hour.tem")
End Sub
Private Sub CommandButton3_Click()
RSTrendX1.LoadTemplate (gProject.Path & "\2-hour.tem")
End Sub
Private Sub CommandButton4_Click()
RSTrendX1.LoadTemplate (gProject.Path & "\isograph.tem")
End Sub
Private Sub CommandButton5_Click()
RSTrendX1.LoadTemplate (gProject.Path & "\non-isolated.tem")
End Sub
Private Sub CommandButton6_Click()
	gTagDb("prog\LotNumber").Value = "No File Loaded"
	gCommand.Execute "Login_out"
	Unload Me
End Sub
Private Sub CommandButton7_Click()
	On Error Resume Next
	RSTrendX1.Overlays.Remove (1)
	LoadHistory
End Sub
Sub LoadHistory()
	History.Show
End Sub

Thanks to all that helped :)


EDIT:
BTW Nathan... here is some more code to make a simple trend work :D
 
Last edited:
lol - sometimes ya gotta do whatcha gotta do! I'm glad you weren't SOL in the end.

geniusintraining said:
EDIT:
BTW Nathan... here is some more code to make a simple trend work :D
 
Lancie1 said:
Thanks, GIT. I learned another trick.

Wow!! I showed the teacher something :) :)

Your welcome Lance, its about time I showed you something... now the score is 1 to 1000
 

Similar Topics

any input would be appreciated! we had one over head conveyor system, we need to identify every moving mustache position at loader and unloader to...
Replies
7
Views
2,050
Good Afternoon , I'm sure there are many Ishida Muti-Head Weigh Systems . We have a Ishida CCW-M-214W Multi-Head system . We are...
Replies
1
Views
418
Hi all, have a project which requires reading a weigh head weight over ASCII. Never really touched ascii so struggling a bit. The weigh head is in...
Replies
11
Views
1,182
Good Morning , We have a Ishida Multi-Head Scale . I had experiece with them for chips , crackers , etc. , but now we are using them for...
Replies
7
Views
424
Hello expert I have migrate legacy project that use Applicom OPC DA with 3rd client and S7-400. I see in client code add item string call...
Replies
0
Views
344
Back
Top Bottom