I am working with RSView 32.

I am taking 3 strings from one machine, concatenating them using VBA to create a master string and determining the length of that master string. Both the master string and its length are tags in my tag DB. Those tags are then sent to another machine.

The problem is that the masterstring length must be sent to the machine before the actual masterstring is sent. I know I should be able to #1 concatenate, #2 determine the length, #3 write the length of the masterstring to tag DB, then #4 after a short delay, write the masterstring to tag DB. But I don't know the code to do that. Any help out there?

How can you determine the length of a string tag before you create the string tag itself?

below is the code i am using:

[vba]
Sub MasterStringConcatenation()
Dim MasterTag As Tag
Dim ProductIDTag As Tag
Dim RollIDTag As Tag
Dim RollPathTag As Tag
Dim MasterTagLength As Tag

Set MasterTag = gTagDb.GetTag("EI_NEXT_ROLL_STRING")
Set ProductIDTag = gTagDb.GetTag("MEM_PRODUCT_ID")
Set RollIDTag = gTagDb.GetTag("MEM_ROLL_ID")
Set RollPathTag = gTagDb.GetTag("MEM_ROLL_PATH")
Set MasterTagLength = gTagDb.GetTag("EI_NEXT_ROLL_STRING_LEN")


MasterTag.Value = "RollSetup" + vbLf + "Next={" + vbLf + " RollID=001" + vbLf + " RollPrefix =" + _
Chr(34) + RollIDTag.Value + Chr(34) + vbLf + " RecipeID =" + ProductIDTag.Value + vbLf + _
"RollDirectory=" + Chr(34) + RollPathTag.Value + Chr(34) + vbLf + "}"

MasterTagLength.Value = Len(MasterTag.Value)
MsgBox MasterTag.Value
MsgBox MasterTagLength.Value

End Sub
[/vba]
The extra stuff in the concatenation is there to meet special formatting requirements for the machine the string is being sent to.

Thank you for your help!

EDIT: Added VBA Tags Tommy