Jump to content
We've recently updated our Privacy Statement, available here ×
  • How to Display Ad Hoc View Custom Function Arguments


    asimkin
    • Features: Ad Hoc Version: v7.5 Product: JasperReports® Server

    Request Description

    User created a custom function in Ad Hoc View to be used in calculated measure or field as described in article

    How to Add a Custom Function to Ad Hoc View Calculated Measure/Field Functions List

    In Function Description section, customer would like to display information about function arguments in the same way it works for pre-defined once:

    Average("NumberFieldName", 'Level')

    How to implement it?


    Solution

    Information about functions arguments stored in

    jasperserver-proscriptsadhoccalculatedFieldsfactorycodeExampleFactory.js

    Javascript file.

    The file contains an array of functions definitions:

    var codeExamples = [....[/code]

    You can add your custom function arguments into the array using already provided functions details, for example:

    {  // ascii ("FieldName")  functions: ['ascii'],  code: '"' + getArg('TEXT_FIELD') + '"'}[/code]

    customfunction_arguments.png.bc504b015c372b5d9aa394cc8de666a1.png

    Complete list of possible argument types and their translations defined in

    jasperserver-proWEB-INFbundlesadhoc_messages.properties[/code]

    file:

    # Argument parts used in Function syntax examples

    ADH_425_ARGS_FIELD=FieldName

    ADH_425_ARGS_TEXT_FIELD=TextFieldName

    ADH_425_ARGS_NUMBER_FIELD=NumberFieldName

    ADH_425_ARGS_DATE_FIELD=DateFieldName

    ADH_425_ARGS_BOOLEAN_FIELD=BooleanFieldName

    ADH_425_ARGS_DATETIME_FIELD=DateTimeFieldName

    ADH_425_ARGS_NUMBER_OR_DATE_FIELD=NumberOrDateFieldName

    ADH_425_ARGS_FIELD_VALUE=FieldValue

    ADH_425_ARGS_RETURN_VALUE=ReturnValue

    ADH_425_ARGS_ELSE_RETURN_VALUE=ElseReturnValue

    ADH_425_ARGS_LEVEL=Level

    ADH_425_ARGS_INTEGER=Integer

    ADH_425_ARGS_INTEGER_OFFSET=Integer_Offset

    ADH_425_ARGS_TEXT_STRING=string expression

    ADH_425_ARGS_START_POSITION=Start_Pos

    ADH_425_ARGS_LENGTH=Length

    ADH_425_ARGS_TRUE_CALC=TrueCalc

    ADH_425_ARGS_FALSE_CALC=FalseCalc

    ADH_425_ARGS_NAME_STRING=name

    ADH_425_ARGS_CATEGORY_STRING=category

     

    Solution tested with TIBCO JasperReports® Server v.7.5.0


    AS-20200520, case 01848172


    User Feedback

    Recommended Comments

    The changes mentioned in the Wiki article involves editing JavaScript files. JasperReports Server uses optimized scripts by default. And after making the changes to the JavaScript files, we will need to rerun the optimize script as explained in below document:

    https://community.jaspersoft.com/documentation/tibco-jasperreports-server-ultimate-guide/v750/customizing-javascript-files

    As a quick test, to see if the changes have taken place, you can append &opt=false to your JasperReports Server URL to run it in non-optimized mode, like:

    http://localhost:8080/jasperserver-pro/flow.html?_flowId=homeFlow&_opt=false

    Link to comment
    Share on other sites



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...