1. Abimael Lopez Cotto
  2. Valentina Reports ADK
  3. Dienstag, März 13 2018, 02:59 PM
  4.  Abonnieren via E-Mail
Hello , I have in the open event for the app my valentina license.

I create a container and a button and this is the following instruction I did :

try 

//Open Connection
dim conn as VConnection = new VConnection("127.0.0.1","username","password")
conn.Open


//Open Valentina Project
dim projPath as FolderItem = GetFolderItem("ercdtt.vsp")
dim proj as VProject = new VProject(conn,projPath)
proj.Open


//Print Report into PDF to RAM
dim datasource as String = "mysql://host='localhost' port='3306' dbname='database' user='username' password='password'"
dim query as String = "Select * from dtt_timerDayPartsReportPopeyes85901"


dim report as VReport = proj.MakeNewReport("DayPartPopeyes",datasource, query)
dim data as string =report.PrintToBuffer(EVReportPrintType.kToPDF, 1 )

// Preparate the file for Download
mPDF = new WebFile
mPDF.MIMEType = "application/pdf"
mPDF.Filename = "report.pdf"
mPDF.ForceDownload = False
mPDF.Data = data


//Close Project and Connection
proj.Close
conn.close


// Show PDF in Browser
showURL(mPDF.URL)


exception err as VException
dim errNumber as Integer = err.errorNumber
dim errString as String = err.Message

end




Xojo build the project good and I have the valentina project(vsp) in the same folder os my web app. When I click the button nothing happen. I already see the video in you tube of Valentina in Xojo Web APP.

Any Ideas?

Thanks
Kommentar
There are no comments made yet.
Abimael Lopez Cotto Akzeptierte Antwort
Is working fine but I need to open in a separate url tab. The reason is when I click back in the pdf url in Xojo the system back to the login page.
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
It is possible to open a document in a new browser tab:
showURL( mPDF.URL, true )

But the browser (Chrome in my case) blocked this attempt, so I had to allow it explicitly.
Kommentar
There are no comments made yet.
Abimael Lopez Cotto Akzeptierte Antwort
Thanks guys is working fine now, Thanks foe all your help. Is it possible open the pdf in a different URL?.
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
I installed the same system and used the sample code you posted before.
After installing the fonts I generated the report.

I attached the project.

The MySQL table is as simple as

CREATE TABLE `dtt_timerDayPartsReportPopeyes85901` (
`f1` VarChar( 255 ) NOT NULL,
`f2` VarChar( 255 ) NOT NULL,
`f3` VarChar( 255 ) NOT NULL );

INSERT INTO `dtt_timerDayPartsReportPopeyes85901` ( `f1`, `f2`, `f3`)
VALUES ( '1', '2', '3' );


If you are still unable to get a report please try the following.

1) Try to debug the application on Windows in Xojo IDE. Go line by line, check the data variable with report - is it empty?
Use the same MySQL server address in the Valentina Studio and Xojo applications - so there will not be the local 127.0.0.1 address in the datasource, but actual network address of the Linux server.

If the MySQL server rejects connections - it may be bound to the local address, so fix the mysql.cnf.
If the user is not allowed to connect - create the user that can connect from any host.

2) Switch the deployment type to Stand Alone. For example, on port number 9000.
It's much more convenient to test in this mode at first - you control the application completely, you make it executable, run it from the command line, stop it at any moment with Ctrl+C, check actual output.

The firewall may block connections to this port, so it is necessary to allow them, or just disable the firewall temporarily, like:
sudo ufw disable.

3) Enable the logging in the application, the log will be created in the folder vlogs next to the executable.
Valentina.DebugLevel = EVDebugLevel.kLogParams

It even shows the contents of generated PDF.

--
Once the application runs fine - you'll change the address to whatever you wanted, adjust the user and switch back to CGI and enable the firewall if you want.
Anhänge
Kommentar
There are no comments made yet.
Lynn Fredricks Akzeptierte Antwort
Sergey has been trying to help you resolve your issues, and it isn't clear yet where the problem is or if it has anything to do with Valentina. We can only work with the information you are supplying to us, when you supply it to us.

We have per incident support where you could supply your project to us and we can try to resolve why it isn't working. That might be much more cost effective then trying to start all over again.

You can also continue to ask here and we'll try to answer as best as we can.
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
And if you run in Xojo IDE on Windows - it works, right?
Is it the same sample, or it is another application?

You can try to compile it as a Stand Alone application and run on a free port - maybe there will be some helpful message printed in the output console.
Kommentar
There are no comments made yet.
Abimael Lopez Cotto Akzeptierte Antwort
I do not have any desktop environment installed only web (CGI). I just enter my URL and login to the web page.
I install the fonts but still show to me the blank page. When I use the Valentina studio the preview work fine.
In my app open event I have the tree licences Valentina.InitReports("Mac Lincense",Windows License", "Linux License";)
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
So you don't have any desktop environment installed there, just the command line?
Then the problem can be in fonts - maybe there are no fonts.

Usually, I install some basic fonts and it works:
sudo apt-get install ttf-mscorefonts-installer
sudo fc-cache
Kommentar
There are no comments made yet.
Abimael Lopez Cotto Akzeptierte Antwort
My version of the Linux server is Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-32-generic x86_64). I programing in my Windows 10 Laptop.
and my app is a Xojo web app version 2017 r3
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
Hello,

What version of Linux is used? Does it have the desktop environment or only the command line available?
Kommentar
There are no comments made yet.
Abimael Lopez Cotto Akzeptierte Antwort
Hello, Now the button open the PDF File but show to me a blank report.
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
The code doesn't show an error.

Please try to put breakpoint to

dim errNumber as Integer = err.errorNumber
dim errString as String = err.Message

Will it stop there, what was the error?
Kommentar
There are no comments made yet.
Abimael Lopez Cotto Akzeptierte Antwort
The system do not show any error only do not show nothing. I click the button and nothing happen.
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
Looks correct. Is there any error during execution?
Kommentar
There are no comments made yet.
Abimael Lopez Cotto Akzeptierte Antwort
this is the code I have for the button

try

//Open Valentina Project
dim projPath as FolderItem = GetFolderItem("Ercdtt.vsp";)
dim proj as VProject = new VProject(projPath)
proj.Open


//Print Report into PDF to RAM
dim datasource as String = "mysql://host='127.0.0.1' port='3306' dbname='databaseName' user='userName' password='userPassword'"
dim query as String = "Select * from dtt_timerDayPartsReportPopeyes85901"


dim report as VReport = proj.MakeNewReport("ValentinaReportName",datasource,query)
dim data as string = report.PrintToBuffer(EVReportPrintType.kToPDF, 1 )

// Preparate the file for Download
mPDF = new WebFile
mPDF.MIMEType = "application/pdf"
mPDF.Filename = "report.pdf"
mPDF.ForceDownload = False
mPDF.Data = data



//Close Project and Connection
proj.Close


// Show PDF in Browser
showURL(mPDF.URL)


exception err as VException
dim errNumber as Integer = err.errorNumber
dim errString as String = err.Message

end
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
Just remove the VConnection:

try

//Open Valentina Project
dim projPath as FolderItem = GetFolderItem("ercdtt.vsp")
dim proj as VProject = new VProject(projPath)
proj.Open

...

//Close Project
proj.Close

...

Kommentar
There are no comments made yet.
Abimael Lopez Cotto Akzeptierte Antwort
Thanks for your respond, I try to find any example or code using MySQL in Xojo web but I do not found it, do you have any example code.
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
Then you don't need to use VConnection at all, only the project
Kommentar
There are no comments made yet.
Abimael Lopez Cotto Akzeptierte Antwort
I do not use valentina server, I have a Linux server hosting my web app from Xojo. I have the 3 licenses of Valentina ADK (Mac,Windows,Linux) and I use Valentina studio in my windows and mac PC. I copy the .vsp project in the same folder I have my .cgi app
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
Hello,

Do you use the Valentina Server?
This code opens a connection to the Valentina Server, so the project must be placed in the "projects" folder of this server and registered
Kommentar
There are no comments made yet.
  • Seite :
  • 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