how to use a factorytalk tag value in vb?

Connor93

Member
Join Date
Mar 2013
Location
Derbyshire
Posts
1
hi guys,

iam using vb to display a popup message when a button is clicked, the popup displayed needs to dependent on the state of the tag associated with that button,

could I use
dim actualTag as ?????

any advice or examples would be appreciated, iv used the rockwell knowledge base example with no great luck, cheers
 
Here is an example from RsView32, I assume that FT is the same but I've never used it.

Code:
Dim MyTag As Tag
Dim MyTagValue As Variant

  Set MyTag = gTagDb.GetTag(TagName)
  MyTagValue = MyTag.Value
  Set MyTag = Nothing

When you create an object in memory with the Set XXX = something, it is important to clear it and release the memory with Set XXX = Nothing when XXX is no longer required.

if you need to read/write more than a couple of tags at a time then you should considder using the tags collection method to be more efficient.

Code:
Dim TagsColl As Tags, TagPath As String

  TagPath = "PLC\Calibration\"
  Set TagsColl = gTagDb.QueryForTags(TagPath + "*") 'Point to tags
  ' Update Tag Database
  TagsColl.Item(TagPath + "PunchOffsetA").PendingValue = OffA
  TagsColl.Item(TagPath + "PunchOffsetB").PendingValue = OffB
  TagsColl.Item(TagPath + "PunchOffsetC").PendingValue = OffC
  TagsColl.Item(TagPath + "PunchOffsetD").PendingValue = OffD
  TagsColl.Item(TagPath + "PunchOffsetE").PendingValue = OffE
  TagsColl.Item(TagPath + "PunchOffsetF").PendingValue = OffF
  TagsColl.Item(TagPath + "PunchOffsetG").PendingValue = OffG
  TagsColl.Item(TagPath + "PunchOffsetL").PendingValue = OffL
  TagsColl.Item(TagPath + "PunchOffsetM").PendingValue = OffM
  TagsColl.Item(TagPath + "ShearOffset").PendingValue = OffCut
  TagsColl.Item(TagPath + "Goset").PendingValue = Goset
  TagsColl.Item(TagPath + "BlankLength").PendingValue = BlankLength
  TagsColl.WritePendingValues roNoWait
  Set TagsColl = Nothing

Nick
 
You could use VB to accomplish your task but wouldn't it be easier to use animation and stack different buttons for different screens?
 

Similar Topics

Creating a file name from a tag.value Set MyTagGroup = Application.CreateTagGroup(Me.AreaName) Dim Fname, Dfile As String Dim NewFile As Tag...
Replies
4
Views
10,287
Hi, i work on the display where i have list of tags. This names of tags are retrieved from external database. The full name of every tag is...
Replies
4
Views
3,845
Hi, I have 6 fillers, which all run the same. I want to send a value to the same tag address in each of the fillers using FactoryTalk Studio ME...
Replies
4
Views
2,635
I have a FactoryTalk View Se project, Is it possible to export Direct Reference tags to edit in a CSV file or Excel? I know I can export HMI...
Replies
1
Views
288
Expert, Could you advise me some idea how to add tags in Summary Alarm's FilterDefinition? SumView.FilterDefinition = "AlarmShortName LIKE...
Replies
2
Views
910
Back
Top Bottom