Repeater fields

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

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist