Tuesday, August 15, 2006

Giving Filtered Pages a Title

One method to filter data in the browser is to build the filter statement right into the URL. For example, if the URL ...Customers.A5W displays a grid showing all customer records, then ...Customers.A5W?customers_filter=State="CA" (see note below) will show just the customers in California.

When your user views this page of data, they might not know (or remember) how these records are filtered. Here's how you set a dynamic title along with your filter statement in the URL:

...Customers.A5W?title=California Customers Only&customers_filter=State="CA"

To make use of this in your A5W page, place the following xbasic where you want your title to appear:

if eval_valid("title") then
? title
? "My Default Title Here"
end if

That would give you a friendly title of: California Customers Only

And, although it will look a little cryptic, you could omit the title argument and just show the actual filter statement, as follows:

if eval_valid("customers_filter") then
? customers_filter
? "My Default Title Here"
end if

That would give you a title of State="CA".

Note - I used double quotes around the text values, but you really have to use %22 for Alpha database, as in State=%22CA%22.


Anonymous said...

This is a very useful suggestion. Thanks. Selwyn.

Steve said...

It's Steve, not Selwyn!