Tutorial: Use a variable in a library block
In this tutorial we will demonstrate the use of a variable in a library block. For a general description of visualization variables refer to in this article.
Let's assume we want to create a library block that shows the room number and the respective current room temperature of a given room.
The full room number is composed as <FloorNo><RoomNo>, and the ItemID of the room temperature is NETx\XIO\KNX\NETx KNX IP Router Room <FloorNo><RoomNo>/<FloorNo>/1/<RoomNo>0.
First, create a new page named Blocks that is used to design the library block.
For the room number indicator, create a label (function: text). The text is
Room {BK:FloorNo}{BK:RoomNo}
The expression {BK:FloorNo} specifies that at this place during instantiation of the labrary-block-to-be the value of the FloorNo has to be inserted. The analog is the case for RoomNo.
For the room temperature indicator, create a label (function: indicator). On the Object tab, set the item ID to
NETx\XIO\KNX\NETx KNX IP Router Room {BK:FloorNo}{BK:RoomNo}/{BK:FloorNo}/1/{BK:RoomNo}0.
Provide a text format on the Appearance tab: "Temperature: {0:0.0} °C"
Select the room label and the temperature label. Right-click to raise the context menu and select the item Add to library....
- Provide a name for the block and select the library to which you want add the block. Observer that the block variables have already been detected in the selected elements:
- In the object catalog, select Libraries and expand the chosen library's list of elements:
- Switch to the page where you actually want to use the block, e.g. Floor page. Drag the library block onto the page. You are now prompted to provide values for the used block variables:
- Obviously the room number has been set accordingly. Double-click the label element to check the replacement of block variables for the room temperature indicator: