Thursday, December 27, 2007

SnTT: Using @Abstract To Enhance A View

Have you ever wanted to spice up a view a little by adding abstract information to it? That is, to include some of the text of the document in the view itself so the user doesn't have to open it to determine if it is worth reading? This is pretty simple to do using the @Abstract formula.

@Abstract allows you to abbreviate the content of a field in a Notes document. What I find cool is that it can also work on Rich Text fields. Now, @Abstract is very powerful and can allow you to do some interesting transformations with information in a field, but for the purposes of exposing some abstract information in a view, we'll just use the simple stuff.

In order to maintain good performance in your application, you shouldn't use @Abstract in the view itself. Instead, create a new field on the form in question in order to capture the abstract information. You can then refer to this field in the view column. Let's say you want to add this functionality to a document library. Open the 'Document' form and add a new field called "BodyAbstract". This should be a computed text field. The formula for this field would be something like:

@Abstract( [TextOnly]:[TrimWhite]; 1000 ; "" ; "Body" ).

As used here, this will capture the text of the "Body" rt field, trimming out whitespace and grabbing the first 1000 characters (Check out the help file to see how you can enhance @Abstract with additional keyword parameters).

In the view, in order to allow the user to decide whether or not the abstract should be visible for a particular document, I made the "Subject" column categorized, then included the abstract in a regular column. Here's what it looks like in design mode:



And here it is in action:

Click to enlarge


@Abstract is useful for many purposes, and this simple technique exposes just one of those. I think this idea makes sense for a lot of document-based repositories and as a bonus is really easy to implement.

2 comments:

Rocky said...

Chris, don't forget that in 8.0.1 we have a new @function - @AbstractSimple. It basically does the same thing as @Abstract, but without the need to know all those stupid parameters and keywords to get @Abstract to work.

Enjoy!

--Rock

Fire Ball said...

Bạn đang muốn đi du lịch ở Đà Nẵng. Bạn đang đi tìm kiếm kinh nghiệm du lịch Đà Nẵng để có thể học hỏi áp dụng. Hãy ghé vào Villa Đà Nẵng để có thể xem qua những kinh nghiệm du lịch và thông tin liên quan mà chúng tôi cung cấp cho bạn nhé. Ngoài ra chúng tôi cũng đang cung cấp dịch vụ cho thuê villa đà nẵng đảm bảo giá cả rẻ hơn các nơi khác. Nếu có nhu cầu hãy liên lạc với chúng tôi nhé. Đảm bảo chúng tôi sẽ không làm bạn thất vọng. Xem thêm sửu nhi là gì - GATO là gì