Jasper Erpnext Integration

Another git pull and bench update got it working. Parameters are taken dynamically now, its a breeze.

The various methods of setting the parameter is confusing though. Making it a single option would make it easier for the users or a consolidated description(of the multiple methods and the precedence that is followed, the way you have explained in your reply), in the form or Readme would be helpful.

Highly appreciate your guidance all through. Thank you

Thanks for your feedback.

As soon as i get more time i will explain clearly the several ways to set parameters.

If you find more errors let me know.

Thanks.

Hi,
Am back with another question. I need to specify the no. of rows returned by a query using LIMIT as follows:

select x,y,z from tname LIMIT $P!{no_of_rows}

This just needs to be a placeholder. I stored this value in a column and used 'ā€˜is doctype id" and mentioned the column name in "Field doctype valueā€™ , but didnā€™t work. It throws an SQL exception with the query as

select x,y,z from tname LIMIT ā€™

Can you suggest which other options I should use?

Thanks

It should work! I will see why not.

The field name I had referenced in Field Doctype value is of type int(8). It throws the following:

Error in report UT_Labels, error is: object of type ā€˜longā€™ has no len()

I couldnā€™t track it. Thought you might know better!

That is fixed. Iā€™am trying to fix the other error, but that has to do with java and jasperreports itself and iā€™am having some problems in understand where is the error.

I thinks i solved the select x,y,z from tname LIMIT problem.

The problem is in connection permissions. Mysql/Mariadb does not let to connect to localhost but let to connect to 127.0.0.1 by default so i changed. If you have mysql server in the same physical machine then it is ok, just remove, if it is your case, ā€œdb_hostā€: ā€œlocalhostā€, from ā€œyour folder siteā€/site_config.json.

Update and let me know.

Note: You must set the parameter to Integer in jrxml:
<parameter name="no_of_rows" class="java.lang.Integer"/>

Yes, mysql server is in the same machine. But,am yet to get past " object of type ā€˜longā€™ has no len()" error. I see that you have made changes in ln 281 to handle this. But the error occurs earlier, at ln 271

frappe_doc = frappe.get_doc(doctype, docname)
values = getattr(frappe_doc, field)

this is what I could figure out until now. Only after fixing this can I get to the LIMIT problem.

Thanks

Sorry, i made changes in line 256 but i miss that one.

Update now.

Keep me updated!

Ln 391 :
resps.append(self._run_report_async(path, doc, data=data, params=params, pformat=pformat, ncopies=ncopies, for_all_sites=for_all_sites))

I get ā€œerror is: No constructor matching your arguments.ā€

I see the constructor is in place, but not sure why this error is thrown! any clues?

Luis Fernandes

What is The Report you are trying to print? I need to replicate your steps.

This is the same report that has LIMIT in its main query. The param is set to 'is doctype id" and field doctype value set to a column of type int(8). The parameter is also set to java.lang.Integer in jrxml.

Let me know what other details you would need

Problem fixed butā€¦

This problem was identified long time ago but iā€™am being postpone.

I put the python types to be converted to String with str, JasperBase.py line 283. I will see if this is enough, because if you set the parameter type in jrxml file correctly java will convert it to the correct typeā€¦ i hope!

The other solution is to convert every python type to the equivalent java type when possible. But i thinks my solution is best. Convert every python type to String and let java convert type String to the correct type.

If you have any ideas let me know!

Works perfect!

But how may types can you handle like this? Its got to be exhaustive!

Thatā€™s why i convert all python types to String and then let java convert it to the right java type.

Let hope iā€™am right!

Hi
am back with my questions.

Can you help me with the command to install pyjnius directly, instead of ā€œbench update --requirementsā€. I can run ā€œbench update --buildā€ after pyjnius is installed.

I simply want to avoid pulling updates, while installing jasper.

Thanks

Hi.

Do this in frappe-bench folder:

env/bin/pip install cython
env/bin/pip install git+git://github.com/kivy/pyjnius.git

Please start a new topic for each query, it will help in new users searching for specific answers.