February 18, 20206 yr I want to create a form with lets say about 200 text fields that will input only numbers. Upon hitting submit, the data will be sent to the backend, it will be calculated and a good PDF of it will be created like in tabular format and given to the user. Since the data is lot, I will have to make some sort of backup and database system so that if the person filling the data loses power mid away, it won't all be lost. Which is the best language and database do you recommend for hundreds of columns? Learning it won't be an issue.
February 18, 20206 yr Any server-side language can handle the PDF generation and talking to a database. Rather than setting a specific number of individual fields, I would create a client-side app that lets you add inputs as and when you need them, sort of like how this works, but tailored to what you need. You don't really want to have a set amount of database columns either. Some options here are: Save JSON or a serialised array to the database containing all data. This is how custom fields often work in CMS's because you can have an arbitrary amount of fields. Save as a document using a NoSQL database. Something like MongoDB would work well for this because you don't need to have a predefined database schema, it can adapt as your data changes.
February 18, 20206 yr Author 27 minutes ago, Jack said: Any server-side language can handle the PDF generation and talking to a database. Rather than setting a specific number of individual fields, I would create a client-side app that lets you add inputs as and when you need them, sort of like how this works, but tailored to what you need. You don't really want to have a set amount of database columns either. Some options here are: Save JSON or a serialised array to the database containing all data. This is how custom fields often work in CMS's because you can have an arbitrary amount of fields. Save as a document using a NoSQL database. Something like MongoDB would work well for this because you don't need to have a predefined database schema, it can adapt as your data changes. Wow, thank you for this detailed information, Jack. It really helps a lot. I think I will go with MongoDB as I have worked with it before and I want to use a database. PDF generation part can be done later, I can use anything in the backend. But what I am stuck at currently is that what I should use for front end.... PHP? I am confused.... What are my options? Sorry if I sound like a newbie.
February 19, 20206 yr The PDF thing you can do in the browser or on the server side (with Node in this instance) there's pre-made packages that will do this e.g. https://www.npmjs.com/package/pdfkit
February 19, 20206 yr 19 hours ago, lolcocks said: Wow, thank you for this detailed information, Jack. It really helps a lot. I think I will go with MongoDB as I have worked with it before and I want to use a database. PDF generation part can be done later, I can use anything in the backend. But what I am stuck at currently is that what I should use for front end.... PHP? I am confused.... What are my options? Sorry if I sound like a newbie. PHP is a backend language, you could do the PDF generation and talking to the database with a language like that, but you wouldn't be able to do the dynamic client example I posted above without using JavaScript. If you're looking at using MongoDB then I would probably use JavaScript for both the frontend and backend. On the backend side you would use something like NodeJS to generate the PDF and talk to Mongo. Rob posted a package above for Node that can handle PDF generation, and for Mongo there are plenty of packages available like https://mongoosejs.com to interface with the DB. If you don't need authentication and login, this should be fairly straight forward with a bit of JS knowledge and some time spent learning the tools you need. There are plenty tutorials around on using Node and Mongo together.
February 19, 20206 yr If going with Mongo I'd also go with a service that provides that database such as mLab rather than attempting to roll your own. It's just not worth the effort. We use DynamoDB at work for our NoSQL database which works a little differently to Mongo but a good choice if you are using AWS for your hosting. There is also Firebase which I use for my personal projects, that's also NoSQL database as a service and is very easy to interface with the client side - I don't have a backend at all with this setup which means I can host it for free on Netlify and only have to pay for the domain name and DNS. Edited February 19, 20206 yr by rbrtsmith
Create an account or sign in to comment