- In the Infrastructure Administrator, do one of the following:
- Click Enterprise and connect to the enterprise industry model. Open a project.
- Click File and open an industry model drawing or template.
- Select the Industry Model node for the report.
- On the Administrator toolbar, click the Report Designer icon
.
- Open a report definition in the Report Designer.
- Click .
- In the Functions dialog box, click Add.
- In the New Function dialog box, enter a name, such as MyRound. Click OK.
- Under Function, enter the code. A sample function is displayed:
<name> = Me.Record.LngValue("Fid") * 10.
This code reads the value of the attribute FID and multiplies it by 10.
Here is an example of a function to print rounded values. It uses parameters to apply the function to different database columns. The function prints “--” if the attribute value is empty; “Infinite” if the value is 999999; and the rounded value for all other values.dim columnName AS String dim scale as integer columnName = Me.FunctionParameters.Item(0) ' First parameter scale = Me.FunctionParameters.Item(1)' Second parameter if Me.Record.IsDBNull(columnName) then MyRound = "--" 'Attribute value is empty else dim value as double value = Me.Record.DblValue(columnName) if value = 999999 then MyRound = "Infinite" else MyRound = System.Math.Round(value, scale) end if end if
- Click Syntax Check.
- Click Close.
- In the report, add the function control and enter the parameters, for example:
{Fun.MyRound("column_name1",2) {Fun.MyRound("column_name2",7)}