1. Ben Antwi
  2. Valentina Reports ADK
  3. 火, 4月 12 2022, 04:18 PM
  4.  メールで購読
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 承諾済みの回答
Hello Ben,

Does this report work in Valentina Studio and problem only with python?
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
In Valentina Studio it works fine with just producing a record using a parameter for that row.
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
I want to run the sql query example below to enable the user to type in any item_ID the user want , so that sql statement will return the exact record of the item_Id typed by the user.


SELECT item_Id, FROM permanent_staff WHERE staff_no=? ''',([Search_Id])
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
I want to run the sql query example below to enable the user to type in any item_ID the user want , so that sql statement will return the exact record of the item_Id typed by the user.


SELECT item_Id, FROM items WHERE item_Id=? ''',([Search_Id])

コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
@ Sergey Pashkov Please do you understand my logic?
コメント
There are no comments made yet.
Sergey Pashkov 承諾済みの回答
So you defined a parameter and used it in a query that you created in the Valentina Studio.

We have added a method to set report’s parameters in python:
report.setParameterValue( ‘param1’, ‘value1’)
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
This is original table I have below in the image
添付ファイル
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
I have set parameter in patameter Tab as pitem_id and Default Value =4.

This is the query in the Valentina Studio:


SELECT item_id, item_name, item_type from items WHERE item_id=$P(pitem_id)
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
The result from the test Tab is as the image below
添付ファイル
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
I don't want to change my parameter and Default Value all the time when I want to retrieve a record from the table. Please is there a way to set the parameter and Default Value one time to get all records when an input field requires a record ?
コメント
There are no comments made yet.
Sergey Pashkov 承諾済みの回答
In Python?
You use setParameterValue to set an actual value:

report = project.report(...
report.setParameterValue( 'pitem_id','4' )
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
I want to use a search field like the image below to search in my application , so is it possible to use

report.setParameterValue( 'pitem_id','4' )
?
添付ファイル
コメント
There are no comments made yet.
Sergey Pashkov 承諾済みの回答
Yes, that's correct.
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
what if I want to get say last record in my table , please what Default Value should I use?
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
Assuming I don't know the length of item_id column and I want to get the last item_id in the items table, Please what parameter should I set?
コメント
There are no comments made yet.
Sergey Pashkov 承諾済みの回答
For example, you can execute sql query with max function to get the last ID if they are sequential
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
Ok, that's great!
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
Sorry I'm still confused, If a specific parameter Value for example

report.setParameterValue( 'pitem_id','4' )
is set. Meaning after I package the app as .exe I can only search for the record with parameter value of '4'. But I would like to search for any other record. So is there a say a variable that could hold all the parameter values one time?
コメント
There are no comments made yet.
Sergey Pashkov 承諾済みの回答
Store the necessary value in a variable and pass it

report.setParameterValue( 'pitem_id', paramValue )
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
Ok , so can I set the parameter name and parameter value in Valentina Studio Pro as in the image below right?





and pass same parameter Value variable name in python as follows?


report.setParameterValue( 'pitem_id', paramValue )
添付ファイル
コメント
There are no comments made yet.
  • ページ :
  • 1
  • 2
  • 3
  • 4
  • 5


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