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: June 26, 1996
mail to: bcarter@bcarter.com



N-Up Computed Fields

How do I get computed fields to work properly with an N-Up DataWindow? The value calculated for the first row in the detail band is used for the other rows to the right.

Look carefully at the two "Amt" columns and you'll see the right hand values are incorrect (go ahead, use a calculator if you want):

Both computed fields use this expression:

   sales_order_items_quantity *  product_unit_price

If it was a tabular DataWindow that expression would be just fine, so why doesn't it work for the N-Up style? Perhaps it's because the repeated display columns are given suffixes like _1 and _2: It's natural to think these names should be used in the computed field expressions:

   sales_order_items_quantity_1 *  product_unit_price_1
   sales_order_items_quantity_2 *  product_unit_price_2

Nice try, but no cigar: If you do that you'll get the dreaded "Expression is not valid". It turns out that you need to treat the repeated columns as zero-based arrays:

   sales_order_items_quantity[0] *  product_unit_price[0]
   sales_order_items_quantity[1] *  product_unit_price[1]

Here's what the correct display looks like:

The syntax for these array subscripts is rather sensitive. You can insert blanks if you want:

   sales_order_items_quantity [ 0 ] *  product_unit_price [ 0 ]
but if you try removing the blank following the ] character:
   sales_order_items_quantity [ 0 ]*  product_unit_price [ 0 ]

then this is what you'll get:

Now that's an interesting error message. Nowhere in the Help does this definition of "column number" appear, nor is there any explanation of this peculiar array subscripting syntax.

Nevertheless, this solution might help to make the N-Up presentation style more popular by providing some more of the functionality we're all used to with the other styles.


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