1. Ben Antwi
  2. Valentina Studio
  3. 金, 10月 28 2022, 02:45 PM
  4.  メールで購読
Is it possible to pass value of a variable to Valentina Report? Example item_no = 10 which is not from database but it's just a variable in a python script. Will item_no be referenced as a text field in report editor of Valentina Studio?
コメント
There are no comments made yet.
Sergey Pashkov 承諾済みの回答
Hello,

Add an Expression control to the report, different types of expression languages can be used

  • Text With Macros: $P(p_item_no)
  • JavaScript: $P('p_item_no')


Define a default value on the Parameters tab

In Python:
report.setParameterValue( 'p_item_no', item_no )
添付ファイル
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
Hi Sergey

I tried to do as instructed above but it did not work.
However, the variable name in my python script is a global variable and it is called my_counter.
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
The variable name is used in a user defined method. Is it possible to call the method in the valentina report because the method does the math and pass the result to the variable my_counter. And if possible how can I do that please?
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
The user function details are below :



def my_counterfunction(self) :
global my_counter

if count_info[0][0] != " ":
my_counter = my_counter + 1



Can I just call the user defined function in the report or just the variable name my_counter?
コメント
There are no comments made yet.
Sergey Pashkov 承諾済みの回答
You can pass a value - it can be, for example, a variable, literal, or function call that returns a value
report.setParameterValue( 'p_item_no', item_no )
report.setParameterValue( 'p_item_no', '5' )
report.setParameterValue( 'p_item_no', my_function(5) )

So what exactly doesn't work? Is the value set to parameter not printed?
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
Yes please the value set to parameter not printed in report
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
count_info is a database field with type as text.
So all I want to do is to check if the field is not empty then my_counter is increased by 1.
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
I have already set this in valentina studio
添付ファイル
コメント
There are no comments made yet.
Sergey Pashkov 承諾済みの回答
I would add a default value for the parameter to see how it is printed from Valentina Studio.
So you added an expression control containing p_count_no parameter?
With a default value, you can test its printing.
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
Hi Sergey
Is it possible to run a join query in valentina pro because I tried and it returning an error?
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
This is the example that returns the error:


SELECT p. name, p. address, lt.start_date,end_date GROUP CONCAT('C:\\Users\\my-pc\\Desktop\\test\\img\\' || ' picture.png') As full_path FROM first_table p
JOIN second_table lt
ON lt.id_no = p.id_no
WHERE p.id_no = '123'
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
@Sergey I figured it out. I omitted a, before GROUP_CONCAT
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
Hi Sergey
When I run my .exe application and I leave it idle for some time the valentina report does not work.
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
Please is it because I'm using a demo version of the valentina studio?
コメント
There are no comments made yet.
Sergey Pashkov 承諾済みの回答
Hello Ben,

A license is required to generate reports from the Python application.
Without a license, application works for 10 minutes in demo mode.
参照
  1. https://valentina-db.com/en/buy-reports-adk/product/18-valentina-reports-adk
コメント
There are no comments made yet.
Ben Antwi 承諾済みの回答
Please could you check your private message box.
コメント
There are no comments made yet.
  • ページ :
  • 1


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