Document Generation from Traditional Databases
Posted by admin
Creating Documents is universal truth across organizations. Every organization either big or small
MySQL is a robust, scalable, integrated, secure yet simplified DBMS that can hold all of an organization’s sensitive, complex, and mission-critical data all together in a place. Business users create various documents from this data including contracts, invoices, statements, etc.
To generate Word and PDF documents, the software needs to connect to the MySQL database, run queries to extract data, and use that data to generate DOCX/PDF documents.
There are multiple systems and approaches available. Each of them has its advantages and disadvantages. Here, we are looking for an approach that’s business user-friendly and involves no code/less code. Let’s explore the popular choices.
There are a lot of third-party open-source PHP libraries such as fpdf, tcpdf, or wkhtmltopdf that generate PDF documents from MySQL database. While these are free, the below are their main disadvantages.
The logic was to fetch what was needed from the database, render an HTML file from a template, pass in the DB data, then get the puppeteer to load the page and render it to pdf. Then return the pdf to the web app. Using puppeteer means that any CSS you use in chrome can be rendered to a pdf.
Out of the PDF and Word, surprisingly Word document creation is harder. Let’s assume you are given a Word document template with dynamic fields (spaces) like name, address, etc. to be filled in from the database.
To do this, through an ODBC connector, create DNS and use Word mail merge to create Word documents.
In all the above approaches, developers have to develop templates and assist business users in document generation. How about giving the control back to them in template management through DIY document generation?
What separates document generation software from other approaches is, that it allows the generation of Word and PDFs from existing templates. Thus, business users can generate documents themselves without needing much help from the IT team.
It is an API-first software. Users can generate documents either through the system’s UI or you can integrate it with your apps.
If you’re looking to generate complex documents containing multiple tables, lists, and nested lists then EDocGen is the answer. The generation of documents is very simple. It is a 2-step process.
In the connection screen, select the SQL server from the drop-down. Then enter the connection URL in "username@hostname[:port]/DatabaseName" format and the password.
Let’s see how it works. Below are the sample MSWord invoice template and associated query. The system populates the table, image, and dynamic text fields in the template.
SELECT
invoice.inv_no,
`logo`,
`date`,
`trms_pymnt`,
`po_ref`,
`name`,
`address`,
`contact`,
`Email`,
`Phone`,
`myhtml`,
para,
CONCAT(
'[',
GROUP_CONCAT(
CONCAT(
'{"amnt":"',
amnt,
'", "descrptn":"',
descrptn,
'"}'
)
),
']'
) IT
FROM
`invoice`,
`inv_item`
WHERE
invoice.inv_no = inv_item.inv_no
Group BY
invoice.inv_no;
A MySQL document Store allows developers to create either traditional SQL relational applications or schema-less document databases. This eliminates the need for a separate NoSQL document database. You can store both relational data and JSON documents together within one database. For example, both data models can be queried in the same application and results can be in a table, tabular, or JSON format.
In the below query each city becomes an element in an array. We simply pass the Name column (the name of the city) to the JSON_ARRAYAGG() function. We also use a GROUP BY clause to group the results by State. These queries are advisable for creating tables, nested tables, nested lists, etc in your documents.
SELECT
State,
JSON_ARRAYAGG(Name) AS 'Cities'
FROM City
WHERE CountryCode = 'US'
GROUP BY State;
Users can generate documents in various formats including PDF, PPTX, DOCX, TXT, etc. Select the document format from the drop-down and input a name for your documents. You can even prefix the name with one of the dynamic fields.
Enter the file name and prefix for individual documents before clicking the generate button. The output in ZIP format would contain generated documents.
If you’re generating PDFs, the system provides options to add watermark and password protection.
This is an optional step. You can distribute the generated documents for e-Signature and Email.
It offers a complete solution for the automatic generation of complex documents that meet the laws and regulations. It makes it easy for business users to automatically fill in previously created templates with data from the MySQL database.
Schedule a demo to explore SQL to Word generation.
Posted by admin
Creating Documents is universal truth across organizations. Every organization either big or small
Posted by admin
The most common solutions being used are not built for document generation and hence
Posted by admin
Export XML from Oracle DB using SQL query and use that to populate templates using