Wednesday, June 20, 2007

Using embedded view in $$ViewTemplate to control count

This is a simple one, but not sure how many are aware of it. This will work for $$ViewTemplate for someView, and $$ViewTemplateDefault.

In a viewtemplate-form, you can use either a field named $$ViewBody or an embedded view to "hold" the view content/body of the view.

If you use $$ViewBody, you have to use url-parameters to override the default count of 30 entries.

If you use an embedded view in a template, you can control if the view-header is visible, border around the view, the default count (up to the limit set on the server, normally 1000 entries), the default target for ( notes-generated ) links in the view ( generates target-attribute on the links ). It doesn't look like you can disable the action-bar of the view though.

The simplest way to add embedded view to the template, create embedded view -> Choose a View based on a formula -> "" (<-- just use an empty string for the view formula, to avoid confusion in the future).

Demo-db: link

Run the "Make2000Documents" agent to ... generate 2000 documents. Test out different settings on the embedded view in $$ViewTemplateDefault, and open the subject-view to the the effect.

( There are probably a lot of bad naming practices visible in the demo-db. This is because I just started to test out some stuff, and then I decided to post the "stuff" here. ).

A couple of screenshots:

Default 5

Default 500