1. Scott
  2. Report Editor
  3. Sunday, August 27 2017, 08:56 PM
  4.  Subscribe via email
Trying to move as much logic as I can to my VServer/VReports using the scripts feature. Not much documentation on SQL with scripts, however. So I need a little help.

Invoice report (grouped by userID and then sorted on userID and sDate(asc)) which can result in numerous pages. For instance, John Doe (userID 1) worked 3 jobs which are all listed on one page. Jane Doe (userID 2) worked 4 jobs and are listed on the second page (report is grouped by userID), etc, for as many individual people within a time frame.

On page pre-build, I have SQL get the nextVal('invoiceNumber') from a table where I manage my sequences. This will be the invoice number for each page, which I assign to a SQL variable. How can I assign that SQL variable to a field on my report?

And secondly, can SQL scripts interact with JS scripts and vice versa?

Thanks,

Scott
Comment
There are no comments made yet.
Sergey Pashkov Accepted Answer
Hi Scott,

No, currently it is impossible to assign/use the result of SQL script.

As for JavaScript, the report.datasource JS object has the method sqlSelect, but it is not implemented completely due to memory management complications - it doesn't return the cursor yet.

So once it will be implemented, it becomes to be possible to execute SQL and assign the result to a field.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 1
Scott Accepted Answer
Thanks Sergey -

I was using an expression in the page header region to reach out to the DB and get the nextval('sequence'). It works, however, of course it increases the sequence by the number of pages for each page versus just sequentially. Is there any object on the report that is only built/added once?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 2
Sergey Pashkov Accepted Answer
Then maybe you can output the SQL variable in expression?
I used the following expression to output the variable value:
=( SELECT @some_variable )
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 3
  • Page :
  • 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