Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: SQL
Expertise: Beginner
Mar 24, 1997

Repeater fields

Question:
Whenever I try to reference an object in a repeater, I get an error message telling me that "Repeated control can be used only in aggregation function". How can I reference a field in a repeater?

Answer:
I would venture to guess that every OPO developer has come across the fabulous Bas 00394 error message at least one time, and quite probably was vexed by it, at least for a while.

It seems ridiculous that you cannot access an object in a repeater. Just because you are using a repeater to display multiple rows of data does not mean that you don't want to access individual rows.

The OPO designers did give you some very nice functionality with the repeater - the ability to easily use an object in the repeater for aggregate functions like SUM(), COUNT() or AVG(), where a simple reference to the object will give you aggregates of the values of all instance of the object. This made it difficult to use the same object name in references that do not require all of the objects in the repeater.

You can overcome this problem by remembering that a repeater control is really a window into a recordset. If you want to get the value for an object in the current row selected in a repeater, you can use the

repeater_name.GetRecordset().GetCurRow().GetColVal()

function combination for the recordset, and other recordset methods for setting the value of the object. Any and all changes in the underlying recordset are immediately reflected in the repeater.

If you want to search through the values in a repeater, use an loop to walk through the values of the underlying recordset

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date