To add a function to a report

  1. 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.
  2. Select the Industry Model node for the report.
  3. On the Administrator toolbar, click the Report Designer icon .
  4. Open a report definition in the Report Designer.
  5. Click Add menu > Function > Manage.
  6. In the Functions dialog box, click Add.
  7. In the New Function dialog box, enter a name, such as MyRound. Click OK.
  8. 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
  9. Click Syntax Check.
  10. Click Close.
  11. In the report, add the function control and enter the parameters, for example:
    {Fun.MyRound("column_name1",2)
    {Fun.MyRound("column_name2",7)}