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]
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
Recommended Comments
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 accountSign in
Already have an account? Sign in here.
Sign In Now