Greetings
I am kinda new to manipulating database results in PDF.
I am currently trying to generate a multi-pages PDF with a sql table query (in a first step) and I would like to get one record per content.
For example : I have a table named : customers containing 10 records (names, adresses and so)
I would like to have 1 customer per PDF page with all the information
How can I do that ?
- I can actually set up the database connection, returning me all the fields, but I do not see how to populate them when I generate the PDF.
- How can I set the "1 record per page" functionality ?
- I do not want to set up some buttons in the form to navigate though the records (first, next and so) neither do I want to update the database within the form
- Basically it is mean to perform auto-generation at the end.
These could seem to be easy questions, but I am kinda lost at the moment.
Hope anybody can help me
Settha.
Views
Replies
Total Likes
I have done this but I created a table with each row containing a record in the DB. In your case it is the same context but you waould be adding a page instead of a row. Here is my sample (you will not have the DB) but you will see the technique that is being used in the code. The code is behind the getData button. That calls a script object where the real code is placed.
Hope that helps
Paul
Views
Replies
Total Likes
Thank you Paul, will try it and give feedback asap !
By the way, is there a simple way to have the display per page and non per row ?
Regards
Settha
Views
Replies
Total Likes
When you look at the code you will see that I am making a call to add the row in a for loop. In your case you would be adding a page subform instead of a row subform.
Paul
Views
Replies
Total Likes
Hi Paul
Well I tried your script but I encountered few issues :
- It does not display the correct information from my tables
- You script is JavaScript isn't it ?
Could you please send me the .mdb file you used so I can make it work ?
I do use a mySQL table with a simple table containing 3 fields as example but I can get anything from it.
Regards
Settha
Views
Replies
Total Likes
Managed to advance a bit but it seems to be a database query issue :
-I set a MySQL connection to a database (test successful)
-I want to get "table_1" content displayed (from the database)
-> Using the following sentence from you example :
xfa.sourceSet.DataConnection.nodes.item(1).query.setAttribute("text", "commandType");
xfa.sourceSet.DataConnection.nodes.item(1).query.select.nodes.item(0).value = "Select * From table_1";
then trying to connect :
Error occurs on the connection part :
// Need this try catch when user types invalid search criterion.
var sOpen = "";
try {
oDB.open();
oDB.first();
} catch (e) {
sOpen = "failed";
// Reset the item line fields.
oSubform.resolveNode("PartNumber").rawValue = "";
oSubform.resolveNode("Description").rawValue = "";
}
Where I have no result from the query ...
Any idea ?
Settha
Views
Replies
Total Likes
Well, I managed to get the answer : never perform a SELECT * FROM but instead, name all the requested columns !
Settha
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies