SUM on user-defined type

This forum is to report technical problems with Rel.
Post Reply
blambeau
Posts: 4
Joined: Thu Jan 30, 2014 5:01 pm

SUM on user-defined type

Post by blambeau »

Hi!

I'm just trying to get SUM(PARTS, WEIGHT) working with WEIGHT being "TYPE WEIGHT POSSREP {WEIGHT RATIONAL};"

I end up with

ERROR: RS0055: Could not find operator SUM(RELATION {PID P#, NAME NAME, COLOR COLOR, WEIGHT WEIGHT, CITY CHARACTER, %attributeName5 WEIGHT}, INTEGER)

I've tried defining OP_PLUS, but without much more success.

Any hint?

Thanks a lot,
Bernard
Dave
Site Admin
Posts: 368
Joined: Sun Nov 27, 2005 7:19 pm

Re: SUM on user-defined type

Post by Dave »

Try SUM(PARTS, THE_WEIGHT(WEIGHT))
blambeau
Posts: 4
Joined: Thu Jan 30, 2014 5:01 pm

Re: SUM on user-defined type

Post by blambeau »

Lol, sure. But what if it makes sense to consider that WEIGHT + WEIGHT -> WEIGHT and I want to have SUM working out of the box?
Dave
Site Admin
Posts: 368
Joined: Sun Nov 27, 2005 7:19 pm

Re: SUM on user-defined type

Post by Dave »

Sorry, at present you can't, because the built-in aggregate operator SUM is only defined over INTEGER and RATIONAL.

A future update will support user-defined aggregate operators, which will permit defining SUM over user-defined types.
Post Reply