1. Ben Antwi
  2. Valentina Studio
  3. Пятница, Октябрь 28 2022, 02:45 PM
  4.  Подписаться через email
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