Browse UpdateViewRecord Fails When Using GROUP BY

In a browse using GROUP BY as set on the SQL Advanced tab, an error is posted in the UpdateViewRecord method from the following line:
REGET(SELF.View,SELF.ListQueue.GetViewPosition())

The browse data does display correctly. if GROUP BY is removed, the error is eliminated.
Each record is of course unique and the list order does not involve a timestamp (only integer, cstring)

Obviously, REGET depends upon a valid POSITION(view) string value. Any ideas why this would fail?

What does your driver tracing show?

I wonder if POSITION(View) is triggering an ERRORCODE().

The ViewPosition is saved in the parent call of SetQueueRecord().

Perhaps you could try reading POSITION(SELF.View) before the parent call of SetQueueRecord and see if any error code is posted.

Not 100% sure as I did not test all possibilities BUT by including the primary key in the SQL query, I avoid the REGET error.

This is somewhat at odds with the templates since the SQL Advanced tab settings require Do Not Include Primary Key to be checked in order to use GROUP BY. The work around was to list the PK field as hot and add to the Group By string.

Depending on what your view and group by looks like, adding the primary key to the group by will break the aggregate functionality.
It will only work if you have child tables to the top level table and are doing group by on a child table column.
Even then it will cause you to get a count/sum/aggregate of the child table value for each of the parent rows.

In this case adding the PK was not a problem, but it does make me wonder about those other situations and how POSITION(SELF.View) is handled. Usually, I prefer creating these views on the server rather than in Clarion, but in this case it is single use and seemed easier for specifying query filters conditions.