Instead of hard coding a table when you are not sure how many rows you need you can create an embedded view with response documents to act as rows.
We've all had a situation where we need a dynamic table inside of a document. We just don't know how many rows are needed. So we pick a good number that will work for most situations and create a hard coded table. Another method is having the one edit row at the top of a table and moving that row into a table. It works great if the text in the rows does not wrap, or if you have no need to access specific data in a particular row.
A good example of this is a requisition or a purchase order:
- With the Embedded View feature you no longer have to deal with hard coded rows. Create your main form for the header portion of the requisition.
- Create a response document form that would have the information for each requisition row.
- Create a view that displays just the response documents categorized by a field that is carried down from the main form (i.e., PO number or ParentUNID). Include in this view the information that makes up a row (item, quantity, price, extended price). Allow the rows to expand as needed.
- In the main form create an embedded view object. In the Embedded section put in the view name. In the 'Show Single Category' put the field name of the category. Uncheck the 'disable scroll bars' property.
- Add a button to the main form just above the embedded view that performs an @Compose on the response document.
Now the user can create as many rows as needed and scroll through them. You can add totals to the view as well. The user can double click on any item to open the row and change the values and save it.
If you want to make it really slick, create the view and allow 'Inviewedit'. Then the users can edit the rows inside the embedded view object just as they would a table. The users will always deal with one document not realizing that all the rows are response documents.
MEMBER FEEDBACK TO THIS TIP
I just wanted to write to say that this is a very very elegant solution and by far the simplest and most flexible I have ever seen in the many articles I've read on the web regarding this topic.
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip exchange by member Julie Snyder. Please let others know how useful it is via the rating scale at the end of the tip. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.