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.
  • Страница :
  • 1
  • 2


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