Pass parameters to Building Blocks

Top Previous Topic Next Topic  Print this topic

Overview:

Sometimes values for parameters defined in Building Blocks must be parsed.

 

Solution:

This section explains how to parse values for parameters defined in Building Blocks.

 

For a better understanding, an example is provided below.

 

In this example a repeating table will be used for creating a Building Block. Then, a parameters will be defined for the Building Block, for background attribute. Afterwards a value will be parsed to this parameter to change its color.

 

parameters_components1

 

1. The cdcatalog.xml file has been assigned as data source from the default installation folder C:\Users\Public\Documents\Ecrion\XF Designer 2013\Samples\XML Samples\Template Samples.

 

2. To insert this repeating table, the user must just drag the ns:cd node from the XML tree, drop it on the worksheet and select Repeating Table.

 

3. To give it a professional look, the user can select the table, access the Design tab and select for example the third format. Also, the user may add the option of alternating table row color. In order to do this, the Conditional Formatting button located in the Formatting group under the Home tab must be selected. From the drop-down list the user  must select the Alternate Table Row Color option.

 

4. After inserting the table, the user must select the table from the Navigation bar, right-click on it and select the Create Building Block option.

In the Create Building Block dialog enter the name and the path for the .xfc file and press OK.

 

insert_building_block

 

5. This action will open the .xfc file in a new XF Designer window were the user will be able to define a parameter for the Building Block.

 

parameters_components10

 

6. To add a new parameter, the user must access the Edit Parameters button located in the Template group under the Review tab.

 

parameters_components4

 

7. In the Parameters dialog the user must select the Add button and the Edit Parameter dialog will be displayed.

 

parameters_components3

 

8. The user must type in the parameter's name ("BackColor") and a default value for the parameter ("red"), and then confirm by clicking on the OK button.

 

9. To validate the use of this parameter, in the Parameter dialog the user must select the recent created parameter and click on the OK button.

 

10. Then, the user must right click on the "table" object in the Navigation Bar and select Properties.

 

11. Then access the Background group located in the Properties pane and click on the arrow pointing in the right direction that is placed near the Color attribute.

 

parameters_components7

 

12. In the Property Value dialog the user must select the arrow corresponding to the Dynamic Value from input XML field and this will display the Edit Expression dialog.

 

13. The Parameters group located under the Working Objects section must be selected. The user must select $BackColor from the Parameter Name section like exemplified in the picture below.

 

parameters_components8

 

14. The user must save the .xfc file and then return to the XFD document to parse values to the parameter.

 

In this example the background color of this Building Block will be changes by parsing values to the $BackColor parameter defined before in the Building Block.

In order to do this, the user must double click on the Building Block and select the More button from the Property Value dialog.

 

parameters_components6

 

15. In the Parameters group the Add button must be selected in order to open the Edit Parameter dialog.

Here "Backcolor" must be typed in the Name field and "blue" in the Value field.

 

parameters_components5

 

16. After the changes are confirmed, the result can be seen by accessing the Print Layout view mode.

 

parameters_components9