Valentina Reports

Using the function below, this works just fine, but how do I use the sql that was defined for that particular report? I have to dropdown that lists all of the reports and need it to use the query that was created for it.

mReport = mProject.MakeNewReport(pu_reports.listindex + 1,host_string,“Select * from fpm_departments”)

In order words, how to I specify to run a query that’s associated with that report in the .VSP project file.

Query stored inside of VSP file, in fact is intended only for DESIGN time.
It help you test your report, preview it against some test db.

After that, in your application, you can use OTHER db, e.g. postgreSQL instead of mySQL.
You can use other query, with other WHERE clause.

You can use even db that have other table name and other field names, if you correct that by aliases:
SELECT other_f1 as f1, other_f2 as f2
FROM some_other_table T1
WHERE …

For REPORT is important only to get cursor with same number of fields, and with same names of fields.

Does this answer your question?

In theory we could provide way to use that “default” query, stored in VSP …
But we do not see many sense in this.
Usually developers need to change at least the WHERE clause , to select different sets of records to be reported.

I was trying to create one report screen that lists all the reports defined in the VSP project, but each report as defined for a different table, so the SQL is different for each one. I was wanting the user to select the report and then it display the data. If I can’t just use the query that was defined or run a query that’s already in the VSP project file, then I have create a table that has the report name and the sql statement so I can insert it into the makereport function.

So if I can tell makereport to run an existing VSP query in the project file, then how would a user “create” a user report and it work in my xojo application??

what would be great is in the makereport function, you either supply the sql statement or something like query=[query_name] and it executes either the sql statement given, or uses the sql of the query that’s defined

Yes we also consider this “query_name” approach. First step was that VStudio 5.4 in Query Builder saves queries under name.

And I like idea to be able from code call SqlSelect( query_name ), while query is stored in db file, or even on DB VServer.
We can do this for Valentina DB exactly.

that way, developers that create the queries in the VSP project file. Some queries will never change, such as providing a listing of entries in a table. it will always be Select * from table. Some of my reports, I’m building the sq

that way, developers that create the queries in the VSP project file. Some queries will never change, such as providing a listing of entries in a table. it will always be Select * from table. Some of my reports, I’m building the sql on the fly and those work great. But I want one screen to allow users to pick the report and then see the data. Right now, I either have to hard code the sql based on the report selected, or create a separate object for each report selected.

The beauty in being able to providing a query name, is that I can add a report and query to the VSP file, ship that out to the client, and it will automatically be added and work appropriately

Ken, I only think – that you have started new thread: Named Queries in reports. :slight_smile:

  • yes I very agree to named queries.

  • List of all reports in VSP file … this is Hmm,
    You can get number of reports, and iterate by index in loop getting report by report, then ask its name.

Where and how you want show this list? If just in grid of Xojo window then you have way right now.
else?

I have a dropdown that lists the reports in the VSP, I select the report name, then create the report based on the index number. Just like in the examples. That part works fine. The perfect solution is allowing to both specifiy or own sql or allowing to use existing queries in VSP file…

I will start Named Queries in reports…

Thanks
Kenny

[quote=33805:@Ruslan Zasukhin]I have talk with developer. He says not easy, because as far as he know …
any OS do not provide single-line function printFilePdfToPrinter()[/quote]

I wasn’t talking about PDF reading and printing, I was talking about printing directly to printer. How?

You guys have a in memory print to bitmap function, right?
Read the native printing settings, page range, etc from the native dialog,
then make a loop rendering the pages and sending to the printer.
Make a visible small window with “Printing page n” and a Cancel button while doing this (changeable thru parameters).

From the user side, the guy just do a “result=nativePrint(parameters…)” and a print dialog will show up and he can print the report as usually people do with other report tools.

Sending a bitmap to printer is the best way? No. But if it’s the easy way right now, do it, and later you guys start to implement an smarter layer, sending proper graphic commands to each OS to talk to the printers using lighter graphic commands. Always try to make it at least 300dpi, less just when the native printer has inferior resolution (very rare), more just when the user manually asked for in a dialog.

Make it work soon, and enhance it latter, this is better than “Our devs said that’s hard and gave up”. :wink:

Rick, for each OS different API. We can spend a lots of time trying to write that.

In QT already exists such cross-platform PAINTER to devices, including printer.
For us it is more wise put efforts on switch to QT, then write same code that present in QT already.

Its right – we not give up. just we have special plan how todo it in the most right way :slight_smile:

NEWS: Microsoft MS SQL as native datasource to Valentina Reports on all OS.

Available in 5.5b15 build

Connection string can be found here .