RSView32 Value Change

ScottR

Member
Join Date
Oct 2006
Location
Cincinnati, OH
Posts
7
How can I determine that a value of a tag has changed in RSView32 and then set a ValueChanged tag to a 1. In Intouch I used a Data Change script to do this.
 
Where is the value changed (by a PLC program for example)?

If it's coming from a PLC, it would be most efficient to detect the change there.

If you must do it in the RSView32 program, you may be able to do this with a derived tag that triggers logic (event?) which stores the value for future comparisons, and sets the bit...next question will be what turns the bit back off?

Give more details please...
 
The value is a string tag coming from a Barcode Scanner. When the string changes I want to run the macro below which should store the past 50 barcodes.

&IncrementTagValue=IncrementTagValue + 1

&Set String$IncrementTagValue$ String
 
So, the string comes directly to the PC with RSView32, not through the PLC?

Then look at derived tags and events. I don't have a copy of Works to give details, but it should be possible to write a script that will:

IF new_data$ <> old_data$
...THEN old_data$ = new_data$
...Data_index++
...If Data_Index >= 50 THEN Data_Index = 0
...StringArray$(Data_Index) = new_data$
END IF

Or something like that...
 
You can also do it using VBA. Every RSView tag objewct has a Tag.changed property (boolean) associated with it but you have to use VBA to access it. Look up the tag object model for VBA for more information. I don't remember exactly what the property is called, it might be called something different from "changed."
 
You can easily miss changes if you use the event detector and derived tag combination, unless the changes are slow. A VBA routine running in the background is a better solution.

Look up the VBA "withevents" keyword in the help files and check the samples.
 
This is the sample code for value change using VBA




Sub m_oTag_ValueChange(Value As Variant)
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Do you want to Add ?" ' Define message.
Style = vbYesNo + vbExclamation + vbDefaultButton1 ' Define buttons.
Title = "MsgBox Demonstration" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000 ' Define topic
' context.
' Display message.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
gTagDb("tes2").Value = gTagDb.GetTag("tes") + gTagDb.GetTag("tes1")
MsgBox gTagDb("tes2").Value, vbQuestion, "hello"
 

Similar Topics

Hello! As of now, my life is in shambles :bonkhead:. For some reason, RSview32 Ver 7.50.00 freezes every time I try to write a value to a tag via...
Replies
1
Views
1,371
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
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,911
Hi Guys I'm having trouble assigning a tag to an activex label on a Multipage Tab. I can assign the tag to an active x label on a normal display...
Replies
0
Views
596
I have followed the procedure below to convert RSView32 project to FactoryTalk View...
Replies
5
Views
1,433
Back
Top Bottom