The “Create a form from a JSON object” requirement in the second feature request sounds like it would probably accomplish what I need.
As it turns out, after spending several hours working on this yesterday, I’ve decided that having two (ultimately more than two) tables is going to be advantageous anyway. What I have now is a postgresql table called “clients” that has one column, client_name (varchar, a primary key). Then I have a second table called “keysandvalues” that has three columns, client_name (a foreign key), key (varchar), and value (text). The primary key is (client_name, key). So this allows me to have different sets of keys for each client, and I think that’s going to be very advantageous.
I’ve got a proof of concept working that displays the clients table, and has buttons for “add client,” “delete client,” and “refresh table” (the latter probably won’t be needed once I get everything coded correctly, but it’s helpful for debugging). When you select the client in the first table, the second table populates with the keys and values for that client. You then have buttons for “add key/value”, “delete key/value”, and “refresh table”. On the right I have a form, that populates with the key (a disabled input) and value selected in the second table. It has an “edit” button, so if you want to change a value, you select the client, then select the key, then fill in the new value and hit “edit”. (I have a constraint so that you can’t accidentally delete a client without deleting all the key/value pairs first. I guess I’ll add a more streamlined way to delete a client and all pairs, with lots of “are you really really sure” popups, but for now this works nicely to prevent screwups.)
It seems to work, and most of the time I spent was reading documentation. This could have been implemented in just a couple hours (probably even less than that) if I didn’t have to teach myself how appsmith works. (I also ran into trouble while using Safari; I’m not sure if these issues are documented, but appsmith works fairly perfectly in Chrome, and fairly poorly in Safari; no big deal, once I figured this out I switched to Chrome.)
Next I’m working on creating a third table, maybe named “options”, that provides options for each type of key. I’ll add a drop-down menu to the form, in addition to the input box. If you select an option from the option menu, it’ll populate the input box. If you edit the input box, it’ll reset the option menu to unselected. Then when you hit the “edit” button it’ll edit the key to the value in the input box. Managing options will be done on a separate page, as it’s not as common of a thing to do, but it will be needed frequently enough that I don’t want people to have to edit the appsmith app to do it.
With “Create a form a JSON object” I could get more fancy, and have different controls besides just option menu and input box (which hopefully will one day be able to be combined into a combobox anyway). But for the most part, I think I’ve got enough to get this out to my staff for testing in the near future. (I probably should add a date-selection box, which can usually be hidden. I can probably use the same hack of updating an input box whenever the date gets updated using the date control, and just storing the value as a string. This will make sense for my use-case, as sometimes you’ll want to put the date as “Unknown” or “July 2021” or something else that doesn’t fit neatly into using a date-selection box.
(One thing I’m doing with all of this is automated PDF generation. Staff should be able to enter in the data, select a PDF template from a list, and download the filled-in PDF. I have some other tools I’m using for PDF generation. Some of which are ready for production, and some of which are just in the planning stages.)
I’m really impressed by how simple it was to create this app and also by how fast it runs. I’ve been trying to do it several other ways, struggling for months and ultimately giving up, and I whipped this up in just a few hours, without making a whole lot of compromises. I’m kind of glad I was forced to rethink things, as the way I was trying to do it previously would have been a lot harder. But it will be useful to solve very limited problems.