Subject RE: [firebird-support] Re: RunSum in Firebird
Author Sasha Matijasic
> There is no way I can do it on the report side.
> I will have to write a stored procedure then.
> I was thinking I can add some generator to my Select statement and make
> it increment automatically for each row.
> Thank you for your help.
>

Hi,

It's pretty lousy reporting if it can't handle ranking, but that aside, you can achieve the same in firebird, but generators are really not the way to do it.
Look at this post for example of how you can get ranking:
http://tech.groups.yahoo.com/group/firebird-support/message/93246

There are gotchas with this approach and you should read about it in 'README.context_variables2.txt', namely there is a limit on number of context variables, and you should be deleting them after use.

If you need it for generating reports, than I would advise to create a stored procedure which will implement initializing and increasing the context variable to make it easier to use on different queries/reports.

Also, based on your posts, it's not really clear if you want ranking or running total, but the principle can be applied to both.

This is just an idea, I've never used it in production, but it should work.

Sasha