How to print records in jam report horizontally

147 views
Skip to first unread message

Danijel Kaurin

unread,
Apr 15, 2022, 4:41:34 PM4/15/22
to Jam.py Users Mailing List
Hi Andrew.

I have table employee_records as bellow:

employee_records.PNG

I need to show this records in report where records are shown horizontally as calendar days. How to do this with jam.py reports:

report.PNG

Regards

Danijel Kaurin

Drazen D. Babic

unread,
Apr 16, 2022, 9:19:29 AM4/16/22
to Jam.py Users Mailing List
Hi, 
it is not Jam reports but the LibreOffice:
Each cell would need to have data.

It might be easier to use your Calendar plugin. Than everyone who has access can look at it and plan 
the leave:

D.

Danijel Kaurin

unread,
Apr 18, 2022, 4:07:55 AM4/18/22
to Jam.py Users Mailing List
Hi Dražen.

This report would be used for legal purposes (employee leave records). So need to use shown report, not standard calendar.

Andrew Yushev

unread,
Apr 18, 2022, 2:35:01 PM4/18/22
to Danijel Kaurin, Jam.py Users Mailing List
Hi, Danijel

I think you can create a template with columns for days called, for example, day1, day2, ..., day31. 
Add a detail band for printing employee information.
Then when preparing cells for each employee set the variables day1, day2, ..., day31 to the corresponding value
from database table employee_records 
     day1 = 

Besides you can hide columns that you don't need this way (will hide columns A and B)

def on_parsed(report):
    report.hide_columns(['A', 'B'])

пн, 18 апр. 2022 г. в 11:07, Danijel Kaurin <yonika...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "Jam.py Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jam-py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jam-py/66829edb-8c11-412d-b795-37200ca342b4n%40googlegroups.com.

Danijel Kaurin

unread,
Apr 20, 2022, 1:51:44 PM4/20/22
to Andrew Yushev, Jam.py Users Mailing List
Ok, thank you Andrew. I will try that. 

Regards

Danijel Kaurin

unread,
Jun 29, 2022, 3:34:07 PM6/29/22
to Jam.py Users Mailing List
Hi Andrew.

I'm trying to user this function:

def on_parsed(report):
    report.hide_columns(['A', 'B'])

but it's trows error:

"can't concat bytes to str"

and

server log:

Traceback (most recent call last):
  File "C:\Users\Zbook\AppData\Local\Programs\Python\Python36\lib\site-packages\jam\wsgi.py", line 629, in on_api
    data = self.get_response(item, method, params)
  File "C:\Users\Zbook\AppData\Local\Programs\Python\Python36\lib\site-packages\jam\wsgi.py", line 658, in get_response
    return item.print_report(*params, safe=True), ''
  File "C:\Users\Zbook\AppData\Local\Programs\Python\Python36\lib\site-packages\jam\server_classes.py", line 444, in print_report
    result = copy.generate(param_values, url, ext)
  File "C:\Users\Zbook\AppData\Local\Programs\Python\Python36\lib\site-packages\jam\server_classes.py", line 469, in generate
    self.on_parsed(self)
  File "EExHRM.reports.radnik_report", line 64, in on_parsed
    report.hide_columns(['A'])
  File "C:\Users\Zbook\AppData\Local\Programs\Python\Python36\lib\site-packages\jam\server_classes.py", line 660, in hide_columns
    cur_col = cur_col[0:-2] + ' table:visibility="collapse"/>'
TypeError: can't concat bytes to str

Regards

Danijel Kaurin

Andrew Yushev

unread,
Jun 30, 2022, 5:46:37 AM6/30/22
to Danijel Kaurin, Jam.py Users Mailing List
Hi, Danijel

Unfortunately I can not reproduce the error.
Can you send me some sample project that generates it.

Regards,
Andrew Yushev

ср, 29 июн. 2022 г. в 22:34, Danijel Kaurin <yonika...@gmail.com>:
Message has been deleted

Danijel Kaurin

unread,
Jun 30, 2022, 5:09:18 PM6/30/22
to Jam.py Users Mailing List
Hi Andrew.

Here is  demo sample. Try to print Customer list report.

Regards

Danijel Kaurin

Drazen D. Babic

unread,
Jun 30, 2022, 10:03:57 PM6/30/22
to Jam.py Users Mailing List
This is also interesting because if I change the Server report module it does not respect the changes even with the refresh...
The only way to pickup the changes is restarting the App. Not sure if this is a bug.
Screenshot from 2022-07-01 10-00-57.png

Andrew Yushev

unread,
Jul 5, 2022, 8:02:48 AM7/5/22
to Drazen D. Babic, Jam.py Users Mailing List
Hi, 

Danijel, I downloaded your project and everything works ok.
Drazen I changed the code and the app changed.

Please watch the video.

Regards,
Andrew Yushev
jam_screencast_00013.mp4

Drazen D. Babic

unread,
Jul 5, 2022, 11:47:09 PM7/5/22
to Jam.py Users Mailing List
Hi Andrew, 
what is the Python version you are using? Are you using virtualenv?

Because with 3.8 and 3.9 it does not work and you can see the exact error here:


Error:
can't concat str to bytes

Which is the same as above screenshot.

Hope this helps

Drazen D. Babic

unread,
Jul 6, 2022, 1:35:12 AM7/6/22
to Jam.py Users Mailing List
It is working only with Python 2.x for me....

yush...@gmail.com

unread,
Jul 9, 2022, 4:33:13 AM7/9/22
to Jam.py Users Mailing List
I tried it on Python 3.9 and it works OK.
I can not reproduce the error.

среда, 6 июля 2022 г. в 08:35:12 UTC+3, Drazen D. Babic:

Danijel Kaurin

unread,
Jan 20, 2023, 3:03:48 PM1/20/23
to Jam.py Users Mailing List
Hi Adrew.

I'm still struggling with this situation: 

- trying to use this function:

def on_parsed(report):
    report.hide_columns(['A', 'B'])

but this error for newer versions of Python is raised (I'm using 3.11):

File "C:\Users\Zbook\AppData\Local\Programs\Python\Python311\lib\site-packages\jam\server_classes.py", line 660, in hide_columns

    cur_col = cur_col[0:-2] + ' table:visibility="collapse"/>'
TypeError: can't concat bytes to str

Looks like "col" parameter is problem. Can you try to fix this?

Regards

Andrew Yushev

unread,
Jan 22, 2023, 2:01:53 PM1/22/23
to Danijel Kaurin, Jam.py Users Mailing List
Hi, Danijel

I fixed the bug in version 5.4.129.
Please upgrade.

Regards,
Andrew

пт, 20 янв. 2023 г. в 23:03, Danijel Kaurin <yonika...@gmail.com>:
--
You received this message because you are subscribed to a topic in the Google Groups "Jam.py Users Mailing List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jam-py/wBcKOT3pYEw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jam-py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jam-py/0e3dbf1f-8cea-41f0-8832-d74a00d0baaen%40googlegroups.com.

Danijel Kaurin

unread,
Jan 22, 2023, 2:27:33 PM1/22/23
to Jam.py Users Mailing List
Hi Andrew.

Thank you, now is fixed. But why this don't hide columns 'X', 'Y', 'Z'?

report.hide_columns(['A', 'X', 'Y', 'Z'])

Andrew Yushev

unread,
Jan 23, 2023, 2:21:08 PM1/23/23
to Danijel Kaurin, Jam.py Users Mailing List
Danijel, can you give me an example?

вс, 22 янв. 2023 г. в 22:27, Danijel Kaurin <yonika...@gmail.com>:

Danijel Kaurin

unread,
Jan 24, 2023, 4:18:58 PM1/24/23
to Jam.py Users Mailing List
Hi Andrew.

Here is example. Try to print any invoice from Invoices view form. I'm trying to hide columns 'H', 'I' (last two in invoice.ods template).

One thin more: when I try to use column number instead of column name as parameter:

def on_parsed(report):
  report.hide_columns([3, 4])

this error is raised:

  File "C:\Users\Zbook\AppData\Local\Programs\Python\Python311\Lib\site-packages\jam\server_classes.py", line 618, in convert_str_to_int
    s = string.upper()
        ^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'upper'

Regards

Andrew Yushev

unread,
Jan 26, 2023, 12:49:26 PM1/26/23
to Danijel Kaurin, Jam.py Users Mailing List
You are right, Danijel.
I fixed the bugs. 
Please upgrade to version 5.4.130.
Thank you for the feedback!!!

ср, 25 янв. 2023 г. в 00:19, Danijel Kaurin <yonika...@gmail.com>:

Danijel Kaurin

unread,
Jan 26, 2023, 2:04:31 PM1/26/23
to Andrew Yushev, Jam.py Users Mailing List
Hi Andrew.

Now everything works perfectly! Thank you for support 🙂

Regards
Reply all
Reply to author
Forward
0 new messages