custom grouping on values

if for example you are storing the number of employees an account has.
would i then be possible to group by accounts which have between 0-10 employees , 10- 20 , 20-30 etc.
is this a custom function or does Kreports have the ability built in ?

Many thanks.

Stephen,

If exact number of employees is not that important to know but only a range, I would customize the field accounts.employees and make a drop down of it, defining the ranges you need. Then you would be able to group on the field in KReporter.
If you need the exact number of employees but only wants to use range in KReport, you will have to use an SQL custom code in “manipulate” tab for employees field > column customFunction
Example:
IF({t}.{f}> 0, IF({t}.{f}<10, ‘1-9’, IF({t}.{f}<50, ‘10-49’,IF({t}.{f}<150, ‘50-149’, ‘150 >’))), ‘no data available’)

CustomSQL01

Val

Thanks Val, Much appreciated.
Works perfectly. Can you store that value to then use in a formula? Or is that one step too far ?

Kind regards,
Stephen Roy

Stephen,
Yes, it’s possible. Give a variable name in column “store”. Then use {yourVariableName} in formula.
Val