How to set up a database and filled-in templates, based on data from a questionnaire?

Hello Internet,

I’m not sure how to accomplish what I want to do.

I want to create a document in Writer, that has fill-in text fields, like a client intake questionnaire e.g.

What is your name? [Fill in text field]
What is your address? [Fill in text field]

I then want to be able to save this data to a database or Calc spreadsheet. I guess with a button at the bottom of the intake questionnaire called something like “Save”, and have it perform a function like “If this is a new record, add this information to the database, if not, do nothing (and maybe show an error “This record already exists”).

I then want to create a bunch of Writer documents from templates, that will pull the data e.g. name and address from the database or spreadsheet. So, I have a bunch of templates that I create, saved someplace. Then based on the client questionnaire, I create a folder for the client, named [Client Name], put the applicable templates in there, I then want the template documents to lookup in the database the records that match the name the folder is named.

Of course I want to know how to do all this, but I guess my question is mostly a terminology question. What are all these buttons, functions and relationships called in LibreOffice, so I can effectively look up tutorials and answered questions? Are there other websites that might have this question answered? Reddit? OpenOffice Forums? Ubuntu forums? Gods forbid StackExchange? I don’t mind if you link answered questions.

I have some experience using fill-in fields in MS Word, and I have some experience with using Mail Merge, but I have never set up a database before (although I taught myself a little bit of SQL on CodeWars).

Thank you for any leads, answers, questions and discussion.

If you use Base as frontend for your database, the forms you use are actually Writer-documents, and can even be saved as individual files, still connected to a database. So all you want is already available. (But you are welcome to to a second implementaion, if you like…)
.

Have you already found the “guide” for Base?
https://documentation.libreoffice.org/en/english-documentation/

1 Like

Okay, cool. Thanks [Wanderer] for that insight. So my questionnaire will be built using a “Form” from inside Base. Does anyone know how I can use fields in the templates to call the correct data from the database file/table?

Yes, some of us are using Base.
.
If your question is really “How does it work?” you may check the properies of each field: There is a second tab to hold the connection to fields. A recent thread has a picture of this (2nd screenshot). In that case it is a column of a grid-control, as you may see in the first screenshot.

Are you running LibreOffice? [yes] [no]

No, it’s mainly a question of network topology.
Having a local network with a database server and all clients with LibreOffice, it is fairly easy to connect the same distributed Base document with the local database server. Then the users can fill out forms, generate reports, fill office documents with database data.

On the internet, with no assumptions about the clients beyond http clients (browsers), you’ve got to use another software stack. You need a database server, a web-server delivering interactive web pages with forms, lots of configuration and some glue code. Then you can do roughly the same as this web site where we communicate through forms attached to web pages filling a MySQL database with our profiles, postings and likes.

@flywire’s suggestion assumes distributed PDF forms, possibly distributed and sent back as mail attachments.
Then you have to extract the form data from all the PDFs that have been filled out and sent back. The Python tool can do the extraction and your Python program using that tool should be able to write the extracted data into some kind of database, true database, text file, spreadsheet, whatever.

Hmm, I think you have the wrong approach.

I’d design the document in Writer, add fields, distribute and collect pdf forms, extract field data into Base.

I’d program it using Welcome to PyPDFForm - PyPDFForm Documentation.

1 Like

You are quite right, but @drxenocide never wrote anything on distributing the docs. (In modern times I’d prefer a website with database for this, unless you are really forced to work offline.)

1 Like

Thank you both. You’re both right in this case.

PyPDFForm might be what I want to use.

Because of the type of business, I don’t really want this information stored or managed on the internet. Also, sending clients PDFs is much more tolerable (to them) than sending them ODTs. But sending them a PDF form, having them fill it out, and somehow securely getting it back to me is security-tolerable. The idea of then running local software that extracts the information from the PDF into a database seems like exactly how I want this to work.

I don’t see a bigger share of my customers using encrypted email, therefore my preferences are on using databases in web-space. One security feature is using a “user” restricted by the database to write to a “incoming”-table and having no rights to read.
.
Out of curiosity: Can you explain how your users solve the “somehow securely” issue? (Encrypted zip?)