1. Ben Antwi
  2. Valentina Reports ADK
  3. Tuesday, February 22 2022, 09:15 AM
  4.  Subscribe via email
HI,
i'm new to valentina suite. I saw the tutorials on how to download and install valentina studio,valentina server and valentina ADK. I want to embed valentina report in my python code but I can't find any video tutorial on that. i saw saw for java implementation. I would appreciate if I'm assisted with the steps to achieve this task. Thanks in advance.
Comment
There are no comments made yet.
Sergey Pashkov Accepted Answer
Hello Ben,

There is no video yet. Did you try to run the examples?
The reports example is Examples/report.py
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 1
Ben Antwi Accepted Answer
@Sergey Pashkov Yes I did run the report.py script and I got this error message "NameError: name 'valentina' is not defined"
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 2
Ben Antwi Accepted Answer
@Sergey Pashkov Yes I did run the report.py script and I got this error message "NameError: name 'valentina' is not defined". Do I have to copy some files to a location before running the script because I tried to install valentina in Pycharm but I only saw Pyvalentina.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 3
Sergey Pashkov Accepted Answer
Yes, it is necessary to add 'valentina' extension to 'site-packages' of your python3 installation, the standard location can be retrieved using the following command:
python3 -m site

What OS do you use? I tried PyCharm on macOS some time ago.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 4
Ben Antwi Accepted Answer
I'm using Windows 10, I tried to run python3 -m site and I got this error message
" Fatal Python error: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings"
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 5
Sergey Pashkov Accepted Answer
Strange, so any script ends up with this error, right?

What version of python is used? Just a normal installation from
https://www.python.org/downloads/windows/
?

Also, there are some suggestions for such an error:
References
  1. https://faun.pub/no-module-named-encodings-a-common-import-error-found-in-python-3-8775436140de
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 6
Ben Antwi Accepted Answer
I'm using python version 3.7.9
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 7
Ben Antwi Accepted Answer
@Sergey Pashkov I reinstalled python and copied the valentina python extension module file into my working directory with no error when I run the report.py script this time, but I don't see anything happening like a popup for saying the report or printing the report.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 8
Sergey Pashkov Accepted Answer
Valentina Reports engine doesn't show dialogs.
The location for the resulting PDF is passed to printToDisk method:


# Print result as PDF
report.printToDisk('./Report_FilmList.pdf')
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 9
Ben Antwi Accepted Answer
Sergey Pashkov It worked fine after adding the location. Does the free version of Valentina Studio has a demo watermark as on the Report_FilmList pdf example?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 10
Sergey Pashkov Accepted Answer
It depends:

  • New projects and reports created in Valentina Studio Free - has a watermark
  • Existing projects created in Valentina Studio Pro and opened in Valentina Studio Free - no watermark
.

Also, any changes (new reports, etc) made in Valentina Studio Free are not saved to disk.
References
  1. https://valentina-db.com/docs/dokuwiki/v12/doku.php?id=valentina:products:vstudio:features_demo#report_editor
  2. http://www.valentina-db.com/docs/dokuwiki/v12/doku.php?id=valentina:faqs:vreport
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 11
Ben Antwi Accepted Answer
Is it possible to also embed Valentina charts such as bar charts and Pie charts on python dashboard? pyqt5 to be specific.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 12
Sergey Pashkov Accepted Answer
It is possible to generate a report with a chart as a picture and use it in QLabel instance (that’s how it is done in Valentina Studio Forms).
So pyqt should work as well.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 13
Ben Antwi Accepted Answer
Sergey Pashkov What about just previewing the report instead of printing, is there any example as such available?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 14
Sergey Pashkov Accepted Answer
No, we have generic examples only, without additional frameworks that are required for GUI apps.

So it is necessary to preview one page of the report in the pyqt5 GUI application?

Approach is the same - generate one page as a picture, e.g.:
buf = report.printToBuffer(kind=valentina.PNG,start=2,end=2)

And show it on QLabel using QImage and QPixmap classes.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 15
Ben Antwi Accepted Answer
Sergey Pashkov I have created sqlite3 database and the file is located in my working directory. When I copy that location of the sqlite3 database file and replace it with that of the valentina_sakila_bl.vdb. And also replace ./valentina_sakila_reports.vsp with my designed test_report.vsp, I get the error below.

project = valentina.project.connect('C:/Users/LT-K101-LAB/Desktop/EC-PROJECT/HR_report_test.vsp')
RuntimeError: [ConnectionParameters] Unable to parse port: /Users/LT-K101-LAB/Desktop/EC-PROJECT.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 16
Ben Antwi Accepted Answer
Now my problem is how to connect to sqlite3 database and print my customized .vsp file to printer.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 17
Sergey Pashkov Accepted Answer
The path to SQLite database is specified in the DSN parameter:

# Make report instance
report = project.report(name='Report_FilmList', dsn="sqlite://path_to_db/db.sqlite")


As for the printer - currently, this functionality is not implemented.
We'll try to add it as soon as possible.

But "printing to printer" functionality doesn't rely on system dialogs - so in some cases (depending on programming language) it is necessary to implement own print dialogs
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 18
Ben Antwi Accepted Answer
Example 1. when I do it this way I get no report output with no error .

# Open local project
project = valentina.project.connect('./first_report_test.vsp')




Example 2.
When I add the full path to the .vsp file location say I get error message
# Open local project
project = valentina.project.connect('C:/Users/LT-K101-LAB/Desktop/PROJECT/V_firstreport.vsp')

error message
RuntimeError: [ConnectionParameters] Unable to parse port: /Users/LT-K101-LAB/Desktop/PROJECT.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 19
Ben Antwi Accepted Answer
@Sergey Pashkov your example code you mentioned is

dsn="sqlite://path_to_db/db.sqlite"
. As shown below but my sqlite database is myDatabase.db instead of .sqlite.
Could you please explain I'm a bit confused with the sqlite database extension part.

# Make report instance
report = project.report(name='Report_FilmList', dsn="sqlite://path_to_db/db.sqlite";)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 20
  • Page :
  • 1
  • 2
  • 3
  • 4


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 2 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories