My goal: Duplicate a page to keep all query’s, components, etc. but using a different table for data
Issue: Not necessarily an issue… just wondering how everyone else accomplishes this
Steps I've taken to troubleshoot: Copy, Paste, spend forever updating references
Additional info: (Cloud or Self-hosted, Screenshots)
Good Afternoon, I’m building out an app and I’ll have 4 pages that are almost identical, just referencing different data tables. I’m wondering what the best workflow would be to duplicate one page that’s working great, and updating the references to the new data tables. The only real difference is the table name and column names (so select/insert/update, and forms need changing). The rest of the page should just update the component names and reference names (contactsTable to locationsTable, contactFormSubmitButton to locationFormSubmitButton, etc.). MOST of the changes could be completed with a find and replace function.
Is there an easy way to do this? Or is it just duplicate the page, scrub through everything manually, and hope nothing gets missed? I’ve tried the AI but it always decides that it knows better and changes way more than it should, regardless how I prompt or how clear I am about what it should be doing.
Great question! @Ranger_ScoutModules are likely your best bet here. The idea is to build your CRUD page logic once as a module, then pass the table name and column names as module inputs, so each page just drops in the same module with different inputs. Have you worked with modules before? Let me know what you think of this idea!
Thanks for your reply! I have used modules, but their limitations prevent them from working here. There’s CRUD, various modals that need to be called, etc. with crossover between the pages. I have customers, locations, and contacts. Customers can have many locations and contacts. From each page you can create new entities via modals, but you can also create relationships from parents. So in the customer detail modal, you can create new contacts and locations without leaving the customers page. This specific workflow is required, and although I’m sure modules might be able to handle it, the setup and data handling was more complexity than just simply copy, paste, find, and replace.
For the 4 pages I needed, I found it not too terrible to just copy and paste, and pull the JS into notepad for some find and replace, then fix the few things that broke during the process. A little more tedious that I was hoping but it didn’t take too long.