Focal Point
Group By a computed field

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9511008331

September 13, 2004, 02:49 PM
<Leah Bell>
Group By a computed field
I am trying to group by a computed field. I have two fields from a table that I concatenated as a compute. Now I need to group by on that new concatenated field. I am getting the error message that you can't sort or group by on a computed field in report painter. Is there a work around? Can you group by on it if it is set up as a define?
September 13, 2004, 05:44 PM
reFOCUSing
You cannot just simply do a BY on a COMPUTEd field because of when it is created. You will need to use a BY TOTAL if you don't want to move the COMPUTEd field to DEFINEd field or if you don't want to create hold file.

TABLE FILE CAR
SUM
SEATS
COMPUTE SEATS_P/I6 = SEATS + 1;
BY COUNTRY
BY TOTAL LOWEST SEATS_P
BY CAR
END
September 14, 2004, 06:06 AM
Piipster
It is correct that you cannot do a straight BY on a COMPUTEd field. You must do a BY TOTAL. In the report painter, right click on your computed field and choose ORDER REPORT BY.

Is SORTing BY the concatenated field all you want to do?

If you want to do
BY fldname IN-GROUPS-OF
then you would have to do this as a DEFINE field or perhaps create a hold file with your COMPUTEd field and then group it in a second step. It will depend on the kind of performance that you are getting on your report.

If you are reporting against an RDBMS it might be better to pull the data and concatenate as a COMPUTE and do the GROUP-BY in a second step.