1. Ben Antwi
  2. Valentina Reports ADK
  3. Вторник, Апрель 12 2022, 04:18 PM
  4.  Подписаться через email
Valentina is a great reporting tool but I'm still finding it difficult to search a record from sqlite database with python. Please I need help
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
No need to change the default value in Valentina Studio , just set value in python.
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Hello Ben,

Do you have any further questions? Sorry, we didn't have an Internet connection for a while.

The latest version of VPython ADK contains a change for report generation - an ability to set any source query for a report:
project.report( 'Report_1', 'sqlite://....', 'SELECT * FROM actor ORDER BY actor_id DESC LIMIT 1' )


In the example, the report is generated for the latest record, without specifying an actual ID.
Комментарий
There are no comments made yet.
Ben Antwi Ответ принят
Hi Sergey Pashkov ,
Sorry for the late reply. So if I want to generate a particular record for a specific actor_id how I do that?
Комментарий
There are no comments made yet.
Ben Antwi Ответ принят
And also after installing Valentina Pro 12 I cannot locate the example folder for python.
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
So if I want to generate a particular record for a specific actor_id how I do that?

There are two ways:
1) Using parameters

The query in Valentina Studio is defined like that:
SELECT * FROM actor WHERE actor_id = $(pActorID)

Then, in Python code, we supply the actual value:

report.setParameterValue( 'pActorID', some_variable )


2) In the latest version - changing the source query:

project.report( 'Report_1', 'sqlite://....', 'SELECT * FROM actor WHERE actor_id={}'.format( some_variable ) )


As you can see you can set any query you want.

some_variable - is an ID that is passed somehow to the script.
Комментарий
There are no comments made yet.
Ben Antwi Ответ принят
Hi,
@Sergey Pashkov I have tried several tried the line of code above but I still get error message saying

report = project.report(name='queryReport', dsn='sqlite://C:/User/RAZOR64/Desktop/EC-PROJECT/EmployeeDatabase.db','SELECT * FROM permanent_staff WHERE staff_no={}'.format(search_id))
^
SyntaxError: positional argument follows keyword argument
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Hi Ben,

Just add the parameter name:
query='SELECT...
Комментарий
There are no comments made yet.
Ben Antwi Ответ принят
@Sergey Pashkov I added query='SELECT... to the sql statement and error previous error is not showing anymore. I'm now getting this new error message

Traceback (most recent call last):
File "C:/Users/RAZOR64/Desktop/EC-PROJECT/report.py", line 8, in <module>
import valentina
ImportError: DLL load failed while importing valentina: The specified module could not be found.
I remember I had this error the very first time and I copied valentina.pyd from the examples folder to my working directory. This time I cannot see the valentina.pyd extension in the examples folder. Although I have the old valentina.pyd in working directory but it's not working for me.
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
It is installed to C:\Users\USERNAME\Documents\Paradigma Software\VPython_x64_12
Комментарий
There are no comments made yet.
Ben Antwi Ответ принят
I have located and copied the valentina.pyd extension file to my working directory but I'm having same error message.
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
What version do you use? What changed since the time when it worked? Was anything updated?

"The specified module could not be found."
Maybe the Valentina extension can't be loaded due to not finding the VComponents library.
Комментарий
There are no comments made yet.
Ben Antwi Ответ принят
Please version of what the python IDE(Pycharm)?
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
No, the ADK itself. Have you updated it and it stopped working?
Комментарий
There are no comments made yet.
Ben Antwi Ответ принят
I downloaded and installed a new ADK but I'm still getting same error.This is really strange.
Комментарий
There are no comments made yet.
Ben Antwi Ответ принят
@Sergey Pashkov I'm I doing something wrong? I checked the vcomponents_win_vc folder in Program Files and there are 11 .dll files present in there.
Комментарий
There are no comments made yet.
Ben Antwi Ответ принят
Hi @Sergey Pashkov Please I need assistance on the valentina.pyd module it's not functioning. I'm stacked and I cannot move forward with my report.
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Hello Ben,

There is an issue with the current build, but the error is different.
We're preparing a new build, it is planned for tomorrow.
Комментарий
There are no comments made yet.
Ben Antwi Ответ принят
Hi Sergey
Thanks for the response, I wil be waiting patiently for the new build. Thanks again.
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Version 12.5.5 is available for download.

Please install it and we'll make a quick diagnostic test.

Run the command prompt cmd.exe.
Execute: python --version (or python3 --version if python is not recognized)
Go to examples in your documents folder: cd "C:\Users\USERNAME\Documents\Paradigma Software\VPython_x64_12\Examples"
Execute: python valentina_create_db_local.py

Is there any error after it?
I attached a screenshot.
Вложения
Комментарий
There are no comments made yet.
Ben Antwi Ответ принят
Hi Sergey

When I run all the commands above in command prompt I get this as shown in the image below.
Вложения
Комментарий
There are no comments made yet.
  • Страница :
  • 1
  • 2
  • 3
  • 4


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