Hi.
If you want to print all records, name your report: profile_report and paste this code on report server module:
def on_generate(report):
profile= report.task.profile.copy()
profile .set_order_by('lastname')
profile .open()
report.print_band('title')
for c in
profile :
firstname = c.firstname.display_text
middlename= c. middlename .display_text
lastname = c.lastname.display_text
report.print_band('detail', locals())
Note: in .ods template, you need to add word "detail" in A column where yor record will be printed. That's why you have problem in your report.
and then this code in profile item client module (call this functions on some view button):
function print(item) {
task.profile_report.print(false);
}
...
If you want to print report based on selected profiles in view form, you need to add report parameter "id" and use this code in report server module:
def on_generate(report):
profile= report.task.profile.copy()
if report.id.value:
profile .set_where({'id__in': report.id.value})
profile .set_order_by('lastname')
profile .open()
report.print_band('title')
for c in profile :
firstname = c.firstname.display_text
middlename= c. middlename .display_text
lastname = c.lastname.display_text
report.print_band('detail', locals())
and this code in profile item cliend module (you need to pass selected id's):
function print(item) {
let selections = item.selections;
if (selections.length === 0) {
selections = [item.id.value];
}
task.profile_report.id.value = selections;
task.profile_report .print(false);
}
Regards
Danijel Kaurin