Adam CS Posted June 9, 2020 Share Posted June 9, 2020 Hi everyone, long time fan of PW but never really got to use it. I finally seem to have a chance to get my hands dirty and was looking for anyone of this fine community to point me in the right direction. What I need to do: I'm trying to build a product that outputs online reports. Each report is made up of several sections that show data for a specific issue. The data is entered by users of different teams, each team sees their own specific data entry forms and the data collected can be output to different modules of a specific report. Data entered by Team1 can finish in modules A, C and F of the Red Report and modules B, D and G of the Blue Report, all this for specific years in order to plot some trends. I hope this is the right amount of confusing. ? So to recap I have: Multiple Teams each with their own forms to enter data that is ouput to Multiple Modules, different combinations of modules make up Multiple Reports that span Multiple Years ...so multiple head scratchings. A few initial questions: Can Templates be heirarchical/composite? I was thinking of having Reports as templates made up of modules that are templates themselves (that could be in some cases be made up of sub-templates). This way I can ouput the whole Report or just a single module. Can I use the same field multiple times in the same fieldset (and template)? This is a total noob question and I'm sorry for that. Here's an example: I have a form where I need to collect data on Materials used by each team. The form allows the user to enter 'rows' where each row collects data for a specific material used by the team (Example: paper, toners, etc..) for each row I collect different amounts of quantities (Example: new paper (kg), recycled paper (kg), etc..). I thought I could setup a generic quantity field (integer) and then use it multiple times to collect the various quantities by defining a different label and field name but always using the same 'original field'. It seems this is not possible and I have to setup each and every field I will need to use even if some might be almost identical, i thought I could 'evoke' a field I setup and 'override' the key and label for the field in order not to cause conflicts. Any help would be greatly appreciated. Thank you! Adam Link to comment Share on other sites More sharing options...
rick Posted June 9, 2020 Share Posted June 9, 2020 6 minutes ago, Adam CS said: Can I use the same field multiple times in the same fieldset (and template)? This is the only part where I wasn't scratchin' my head ? No. You may have multiple fields of the same TYPE, but you must have unique names, similar to files and file names within a folder. You can create a common field that is used within different templates, but you cannot use the same fieldname multiple times within the same template. Link to comment Share on other sites More sharing options...
Adam CS Posted June 10, 2020 Author Share Posted June 10, 2020 Thank you Rick for your reply! Yeah I'm sorry for the head scratching, will try to put up a diagram or something to explain myself better. Ok gotcha on the fields! Will look for a way to organise fields, I can see it getting pretty overwhelming.. Link to comment Share on other sites More sharing options...
dotnetic Posted June 10, 2020 Share Posted June 10, 2020 12 hours ago, Adam CS said: Can I use the same field multiple times in the same fieldset (and template)? You can achieve what you want with ProFields: Table. It is excactly what I did for a customer portal: You can add as many items as you want, and define the type of each field of a row. For example the field "Eigenschaft" is a FieldtypePage, which pulls it options from a list, that my customer can manage himself. Additionally one requirement was, that when one item was already selected, then it should not be selectable in the other rows. I wrote a blog post how to do this:https://dotnetic.de/blog/disable-options-in-select-elements-that-are-already-selected-in-another-select-element/ 5 Link to comment Share on other sites More sharing options...
Adam CS Posted June 10, 2020 Author Share Posted June 10, 2020 Wow thanks dotnetic! ? That's exactly what I was looking for: someone to point me in the right direction. The ProFields: Table was on my shortlist of options and just wanted to be sure that I what I was trying to do couldn't be achieved without ProFields. Thanks! ? Now all I need is to find some indication/examples of some kind of nested templates/hierarchical templates implementation... will keep looking.. I'm pretty sure that with ProFields + nested templates I should have the main ingredients for what I need to do. Cheers! 1 Link to comment Share on other sites More sharing options...
dotnetic Posted June 10, 2020 Share Posted June 10, 2020 57 minutes ago, Adam CS said: Now all I need is to find some indication/examples of some kind of nested templates/hierarchical templates implementation... will keep looking.. I think I can also lead you in the right direction. I think it's possible, if I understood you right. You can get all fields of a template and render them in a module, if you want to. And so you can with multiple templates. Do you want to do the output on the frontend or in the admin? Maybe I find the time in the next 2 days to give a more detailed answer. 22 hours ago, Adam CS said: made up of modules that are templates themselves What do you mean with that? What you mean with modules? ProcessWire modules or just a modular approach? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now