How to use custom function in the report
How to use custom function in the report
hello
If i want to use the method in the java class(in the jar files).What should i do for registering the function in the designer.
If i want to use the method in the java class(in the jar files).What should i do for registering the function in the designer.
Re: How to use custom function in the report
Hello.
You can in StiRenderReportAction (like in Samples\webfx\ MyRenderReportAction) define custom function:
You can in StiRenderReportAction (like in Samples\webfx\ MyRenderReportAction) define custom function:
Code: Select all
public StiReport render(StiReport report) throws IOException, StiException {
// Add custom function
report.getCustomFunctions().add(new StiCustomFunction() {
public Object invoke(List<Object> args) {
return ((String) args.get(0)).substring((Integer) args.get(1),
(Integer) args.get(2));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public List<Class> getParametersList() {
return new ArrayList<Class>(Arrays.asList(String.class, Integer.class,
Integer.class));
}
public String getFunctionName() {
return "subStr";
}
});
return super.render(report);
}
Re: How to use custom function in the report
hello.
I've done it in your way.
Here is my MyRenderReportAction define a custom function named subString.I made a breakpoint here,but haven't implemented.
What did I miss?
ApplicationInitializer
web.xml
mrt File
Exception
I've done it in your way.
Here is my MyRenderReportAction define a custom function named subString.I made a breakpoint here,but haven't implemented.
What did I miss?
ApplicationInitializer
web.xml
mrt File
Exception
- Attachments
-
- Exception.png (46.04 KiB) Viewed 5811 times
-
- mrtFile.png (23.22 KiB) Viewed 5811 times
-
- web.xml.png (4.23 KiB) Viewed 5811 times
-
- ApplicationInitializer.png (26.98 KiB) Viewed 5811 times
-
- MyRenderReportAction.png (32.88 KiB) Viewed 5811 times
Re: How to use custom function in the report
Hello.
Plase use next code (Integer->Long)
Сan you make sure that the function render() invoke ?
Plase use next code (Integer->Long)
Code: Select all
public StiReport render(StiReport report) throws IOException, StiException {
report.getCustomFunctions().add(new StiCustomFunction() {
public Object invoke(List<Object> args) {
return ((String) args.get(0)).substring(((Long) args.get(1)).intValue(), ((Long) args.get(2)).intValue());
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public List<Class> getParametersList() {
return new ArrayList<Class>(Arrays.asList(String.class, Long.class, Long.class));
}
public String getFunctionName() {
return "subStr";
}
});
return super.render(report);
}
Re: How to use custom function in the report
hello.
I use this code in jsp,custom function can work.Thanks for your help .But what ApplicationInitializer.java and listener in web.xml do?
I use this code in jsp,custom function can work.Thanks for your help .But what ApplicationInitializer.java and listener in web.xml do?
Code: Select all
MyRenderReportAction myRenderReportAction = new MyRenderReportAction();
report = myRenderReportAction.render(report);
Re: How to use custom function in the report
hello.
what ApplicationInitializer.java and listener in web.xml do?
what ApplicationInitializer.java and listener in web.xml do?
Re: How to use custom function in the report
Hello.
It need to initialize applications settings.
It need to initialize applications settings.
Re: How to use custom function in the report
Not used to register a custom method?Vadim_Matveev wrote:Hello.
It need to initialize applications settings.
Re: How to use custom function in the report
Hello.
Yeszzzz wrote:Not used to register a custom method?