Adding a column to the grid dynamically

I have a query similar to this one on the grid, select count(MemberNo) as MemberCount , sum(SalaryAmount) as TotalAmount, ProvinceID from xxxxx group by ProvinceID

I would like to add RegionID, BranchID after ProvinceID in the select part and in the group by part dynamically so that the query looks like select count(MemberNo) as MemberCount , sum(SalaryAmount) as TotalAmount, ProvinceID,RegionID,BranchID from xxxxx group by ProvinceID,RegionID,BranchID
how do I achieve this.

Re: Adding a column to the grid dynamically

Have a look at:
sc_select_where(add)

Regards,
Scott.

Re: Adding a column to the grid dynamically

I thing sc_select_where(add) will not help here, cause it modifies only the SQL WHERE part, so it’s for dynamic filtering of records. Only dirty workaround I could think of is adding extra hidden rows to grid and unhiding/working with them, if needed, but then I don’t know if it’s possible to change row captions on runtime(init).
Please keep us updated about your solution.

Re: Adding a column to the grid dynamically

Err, your right. I will have to think about this again.

Regards,
Scott.

Re: Adding a column to the grid dynamically

After so many updates, it is possible to do this?
thank you very much

Re: Adding a column to the grid dynamically

please, if you want to ask about query. you have to show to us “create table query” first because we have to know where there field come from to make query right.

if your “…id” field come from one table,

in mysql, you could achieve with

select …
from …
group by concat_ws(’’, field a, field b,…)

if your condition more complex, you could make “view” first then connect “table and view” to achieve the results.