Data links give operators a flexible tool for displaying text and values from process databases. To add a data link to your picture, click the Datalink Stamper button on the Shapes toolbar. In Ribbon view, from the Insert tab, in the Objects/Links group, in the Objects/Links list, click Datalink. If the Toolbox is enabled, click the button on the Toolbox. In the Datalink dialog box, specify your choices for the following settings:
- Access to any data source.
- Data entry.
- Flexible display formatting.
- Definable output error messages.
After completing the Datalink dialog box, click the mouse in the location where you want to place the data link. Once you add a data link, you can access the Datalink dialog box by selecting DataLink Custom Page from the data link's pop-up menu.
The initial size of the data link is determined both by the formatting settings you choose in the Datalink dialog box and by the font settings in the User Preferences dialog box. To change the size of the font, access the User Preferences dialog box through the WorkSpace menu (Classic view) or from the Home tab, in the WorkSpace group, in the Settings list, click User Preferences (Ribbon view), and set the font properties on the Shape Preferences tab. Once you have created a data link, you can resize it by clicking on it and dragging the handles, and reformat it using the Datalink dialog box.
NOTE: If you add a data link by selecting Datalink from the Insert menu (Classic view) or from the Insert tab, in the Objects/Links group, in the Objects/Links list and clicking Datalink (Ribbon view), you first sketch the location and size of the data link, then complete the Datalink dialog box. In this case the size of the data link is determined by your initial sketch.
Entering a Data Source
You can display data from any valid data source using your data link. In the Source field, enter the data source you want. You can also select from the Expression Builder by clicking the Browse button.
Enabling Data Entry
To allow operators to enter data into the data link, select In-Place from the Type field's drop-down menu. This lets you enter data in-place, meaning you can display data as you enter it in the Type field. In the run-time environment, data entered is written to the appropriate database tag during the next scan cycle. When you enable data entry, you can require that operators confirm that they want this data to be written to the database before it is sent. To require confirmation, select the Confirm check box.
To help you configure data, use the Data Entry Expert. This Expert lets you determine which data source the data link receives its data from, and how that data appears.
If you use the Data Entry Expert on a data link, you must set the Data Entry Type value in the Datalink dialog box to None. If you set this value to In-Place, unexpected results may occur.
Use the Data Entry Expert to create the following types of data entry:
- Numeric/Alphanumeric
- Slider
- Pushbutton
- Ramp
NOTE: Do not name your picture after one of Data Entry Expert types. Picture names can conflict with the script variable names used with the Data Entry Expert. For instance, if you name your picture Pushbutton.grf and also use the Pushbutton data entry method, when you enter run mode, an error message appears. If you rename the picture, Pushbutton1.grf, the error message does not appear, since the picture name is now different than the data entry method.
You can access the Data Entry Expert from the Task Wizard. For more information on the fields of the Expert, click the Help button. For more information on using the Task Wizard, refer to the Using Experts and the Task Wizard section in the Understanding iFIX manual.
You can also create custom types of entry in VBA. For more information on VBA, refer to the Writing Scripts manual.
Formatting Data
iFIX lets you format the data you want to display in the data link. First, you must choose one of the following types of data to display:
- Raw
- Numeric
- Alphanumeric
To display data in its raw (or native, C code) format, select the Raw Format check box. You can then edit the format by entering a C format string in the Format field. You can also enter a string of any kind preceding the raw format string (to introduce what the data string represents, for example).
To format numeric data, first select Numeric from the Type field's drop-down menu. Next, enter an integer from 0 to 7 to represent the:
- Whole digits – the number of digits displayed before the decimal point.
- Decimal digits – the number of digits displayed after the decimal point. This value is rounded off to fit into the number of digits specified for the Data link.
The following table shows some examples of how formatted numbers affect the way the data link displays in the run-time environment.
Whole Digits |
Decimal Digits |
Display at Run-time |
2 |
4 |
12.1234 |
1 |
6 |
1.123456 |
6 |
1 |
123456.1 |
0 |
7 |
.1234567 |
7 |
0 |
1234567 |
NOTE: To format a data link to display scientific notation, first select a F_CV, E_CV or A_CV field, enable the Raw Format check box, and specify %e in format field. F_CV and E_CV datalinks using %e raw format, by default, display 6 places after the decimal point. To display more places after the decimal point, for example 15, change %e to %1.15e. A_CV datalinks using %e raw format will always display 15 places after decimal point. To display a leading zero in the link, use the F_CV field and the raw format similar to %02.2f.
To format alphanumeric (or text) data, first select Alpha-Numeric from the Type field's drop-down menu. Next, enter in the appropriate fields the number of lines and the number of characters per line you want to display in the Data link. You can also justify the data to the left, right, or center, by making the appropriate selection from the Justify field.
Be aware that float point precision can differ between a datalink and what is shown in the Database Manager. In order to synchronize the two, use the following .INI file setting in the FixUserPreferences.ini file in the iFIX Local folder:
[AppRunPerferences]
AllowPrecisionAdjustment=0
A value of 0 indicates that there is no special precision adjustment for a datalink, and it will be the same precision as the Database Manager displays. The default behavior is to allow datalink precision adjustment.
Using Tag Groups in Data Links
When using tag groups in data links and using raw format strings, you must be sure to match data types between the values and the format string.
For example, if the tag used is going to be replaced by the value of Fix32.Thisnode.AI1.F_CV, the format string must be %f, or some derivative (i.e. %7.2f). The default when entering a tag group is %s, or string. If you do not adjust this and the types do not match, no formatting will occur and you will only get the value.
Configuring the Output Error Mode
The Error Configuration area of the Datalink dialog box lets you determine how error conditions are displayed by the data link should they appear. You can configure the output to derive its value from:
- An error table, or
- The current value.
For more information on output values and definitions, refer to the Classifying Animations Errors section.
You can also display system information using the data link. To do this, add a data link to your picture as described in this section. When selecting a data source, use the format FIX32.node:system:system field. This data link can display a number of different system parameters of a particular node. Refer to the iFIX Database Reference help for a list of system parameters.
Using the DataChange Event in a Data Link
If you are attempting to use the DataChange Event in a data link, you cannot create the VBA object (such as Private Sub Format1_DataChange) by selecting Edit Script from the right-click menu.
To use the DataChange event with a data link, you must use the DataChange event with the Format child object.
To use the DataChange event with a data link:
- Create a data link.
- Open the VBA Editor.
- Type the following code and press Enter:
Private Sub Format1_DataChange(ByVal DataValue As Variant, ByVal TimeStamp as Date, ByVal Transition As Long, ByVal Reserved As Variant)
The VBA object gets created.
- Enter any desired code.
- Enter End Sub at the end of the subroutine.
NOTE: These steps assume that the Format object name is Format1.