Call us! 512-349-0334 or (877) INDUSOFT

Use one Tag to Pass Complex Information to Linked Symbols in InduSoft Web Studio

When creating linked symbols in InduSoft Web Studio, you may occasionally run into a problem where many objects in the linked symbol do independent things, but when trying to pass the information into  the symbol, you need to create many custom properties and use many tags or members in a class tag in order to supply data to those objects.

A single Custom Property in a Linked Symbol can only substitute 1 tag or class member.  In order to create specific functionality in a linked symbol, you will need to assign a unique custom property tag to each part of the functionality within the symbol, then in the custom property dialog for the completed symbol, each custom property needs to be assigned a value, whether a hard-coded value (that can also be a pre-assigned default as shown below in the example), or a project or system tag.

Here’s an example of a technique that can be used that allows a complex linked symbol to use only 1 string tag to uniquely control 5 different objects within in the symbol:

linked symbol

Create a single string tag and encode it (assemble it) with the data that you want to pass to the Linked Symbol in the following manner: Value1String + Value2String + Value3String + Value4String + Value5String

For instance, the Bargraph Symbol shown above has 5 rectangle objects, positioned in a row, each with a vertical resize animation assigned to them. Each one therefore is designed to show vertical magnitude, basically creating a 5-bargraph display object.

The single string passed to them is encoded with a 3-digit string value from 000 (0.00%) to 999 (99.9%) for each rectangle object.

For instance, using the values: 54.0, 73.4, 46.4, 74.0 and 19.4 and converting each of them into 3-digit strings, then assembling them together into a single default string tag ($sEncodedData in the example below) creates a string that looks like this:

(This is a String Value, not integer) 540734464740194

By using the following filters in the resize animation expression for each rectangle object:

Rectangle 1 Resize Expression: 100*$Num($Asc2Str(46) + $NCopy(#DataTag:sEncodedData, 0, 3))
Rectangle 2 Resize Expression: 100*$Num($Asc2Str(46) + $NCopy(#DataTag:sEncodedData, 3, 3))
Rectangle 3 Resize Expression: 100*$Num($Asc2Str(46) + $NCopy(#DataTag:sEncodedData, 6, 3))
Rectangle 4 Resize Expression: 100*$Num($Asc2Str(46) + $NCopy(#DataTag:sEncodedData, 9, 3))
Rectangle 5 Resize Expression: 100*$Num($Asc2Str(46) + $NCopy(#DataTag:sEncodedData, 12, 3))

the values returned are (as seen by the resize animations in the linked symbol):

54.0

73.4

46.4

74.0

19.4

Each of those decoded values now are used as the resize value for the objects, and assuming that you set the vertical resize value range to be 0 to 99.9, will resize the objects in the percentages shown as the values.

This technique can be expanded and modified to do a large number of different things in your linked symbol using a single string custom property value.

Here is a link to the demo project (shown above), demonstrating how this is done.

 

Comments are closed.