Hi,
I wanted to pass dynamic values(List) as in form of combobox(drop-down) values in reports filter parameter, since parameter type has options like List of entities, entity, string etc I am unable to pass list(fetched from query) to parameter type.
krivopustov
(Konstantin Krivopustov)
January 31, 2023, 1:41pm
2
You don’t have to declare report parameters if you pass them using the report execution API .
For example, if you define the following Groovy dataset in a report band:
def users = params['users']
return users.collect {
['username': it.username, 'firstName': it.firstName, 'lastName': it.lastName]
}
then you can just pass the users parameter as follows, without any additional definition:
@Autowired
private CollectionContainer<User> usersDc;
@Autowired
private UiReportRunner uiReportRunner;
@Subscribe("runReport")
public void onRunReportClick(Button.ClickEvent event) {
List<User> users = usersDc.getItems();
uiReportRunner.byReportCode("user-list")
.addParam("users", users)
.runAndShow();
}
Also can you share a demo project for better understanding
krivopustov
(Konstantin Krivopustov)
February 6, 2023, 11:47am
4
Let’s do it another way: you share a sample project and explain your problem, I try to propose a solution.