Foxhound is the better* Database Monitor for SQL Anywhere.
*better: More thorough, more relevant, more effective.
...more Alerts, more All Clears, more details, more control in your hands.


Breck Carter
Last modified: May 14, 1996
mail to: bcarter@bcarter.com



Better Column Names

Tired of computed columns getting names like compute_0005 in your DataWindows?

Or computed fields showing up as sales_order_items_quantity * product_unit_price?

Computed columns can be given better names in the DataWindow painter by doubleclicking on the column and filling in the Column Name window. But if you're dealing with several different computed columns that are hard to tell apart, it's easier to go back to the SQL Select and give them alias names:

SELECT "sales_order_items"."id",
       "product"."name",
       "sales_order_items"."quantity",
       "product"."unit_price",
       "sales_order_items"."quantity"
          * "product"."unit_price" as purchase_amount
  FROM "sales_order_items",
       "product"
 WHERE ( "product"."id" = "sales_order_items"."prod_id" )
Now the purchase amount will show up as cpurchase_amount instead of compute_0005.

Computed fields are a bit harder. They don't appear in the SQL Select so column alias names cannot be used. And if you fill in the Column Name field on the DataWindow, that name still doesn't show up in the painter.

What you can do is add a /* comment */ to the Computed Field Definition:

/* purchase_amount */ sales_order_items_quantity *  product_unit_price
That comment will now be visible in the DataWindow painter.

With decent column names complex DataWindows are a lot easier to understand and maintain.


Breck Carter can be reached by phone at (416) 763-5200 or via email at bcarter@bcarter.com.