Expand my Community achievements bar.

Subforms For Dummies

Avatar

Former Community Member
I've been trying to create and populate a form with information obtained through a SQL query to an OBDC data source. The query works fine and I can view the the results of my query in the Data View. I did not upgrade to Designer 7 from any other "forms" creating software and I have never attempted to create a form before. I admit that I'm confused by the use of subforms. I haven't been successful in finding a "Subforms for Dummies" instruction booklet anywhere and quite frankly, the Help topics are more confusing than helpful. Certain aspects of my form work fine. My biggest difficulty is getting all of the information to flow down the page. I can display the first row of information from my query, but I never see the subsequent rows. Nothing I've tried works. I know I'm missing something very minute in the scheme of things but I'm ready to pull my hair out. I know there's an expert out there that's laughing at me, but I could use your help.



Thanks
1 Reply

Avatar

Former Community Member
Hello Rusty



I'll try to provide a "For Dummies" explanation for using subforms to deal with repeating data. So the scenario is that a Form is being used to present data; some XML structure with repeating complex elements is being passed into a form as an initial data set.



1. Define fields to display the elements for one set of data.

2. Wrap these in a subform and set the Content property to Positioned - you can then re-jig the positioning of the fields within the subform to give them the breathing space they need. Let's call this "pos_sub_form".

3. Wrap pos_sub_form in a subform and set the Content property to Flowed and the Flow Direction to (probably) Top-to-bottom. Let's call this "flow_sub_form".



A Flowed subform will re-jig it's content automatically to squeeze everything into as small space as possible. In this case it will squeeze multiple instances of the pos_sub_form (once we make it so that multiple instances are possible...)



4. Set the data binding of pos_sub_form to the repeating element in the data set and check/tick "Repeat Subform For Each Data Item" (you can also set Min and Max as required).

5. Set the data binding of the form fields to the elements within teh repeating group.

6. Check/tick "Allow Page Breaks In Content" for flow_sub_form.

7. Check/tick "Allow Page Breaks In Content" for the page subform.



Note that by making subform and field names match the data element names the binding can occur automatically. I would advise against this because be being "implicit" it is somewhat hidden and if the data structure changes the form will break but the reason why may not be obvious to whoever is supporting it, again because the binding is implicit.



Note that Flowed subforms squeeze all their content. You can use this to your advantage by including a "header" and "footer" within flow_sub_form before and after the pos_sub_form.



If you require a "continue on next page" type-of-thing, you can create a subform and set it as the "overflow trailer" of the pos_sub_form. Make the trailer a "referenced object" by dragging it in the Hierarchy if necessary. If you require repeated headers you can create a subform and set it as the "overflow leader" of the pos_sub_form. Note that being "overflow leader" might cause the header subform to only appear on pages 2 to x (as "Referenced object") unless you include it the flow_sub_form.



I think that's the crux of it. I hope it helps.



Neil