cancel
Showing results for 
Search instead for 
Did you mean: 

How can i create a grid with summary row

Former Member
0 Kudos
109

Hello Professionals,

I'm wondering how could i create a grid like the grid below, i want to create a grid with summary row,

i have tried to create it using collapsing but it didn't work as required.

Any suggestions?, i want to know just the starting point so i can make deep investigations.

Thanks in Advance,

Accepted Solutions (1)

Accepted Solutions (1)

maik_delly
Active Contributor
0 Kudos

Hi Karem,

this can be achieved by just assigning a datatable containing the data plus some formatting of grid. Meaning there is no feature for that.

The datatable can be filled manually or by sql query. Then you have to attach some events for updating the values ( validate after for gid item ).

A small example for a sql query showing last month quotations and orders with summary :


select 1 as Sort,cast(DocNum as varchar) as DocNum,DocTotal,convert(varchar, DocDate,104) from OQUT where DocDate between  DATEADD(month, -1, GETDATE()) AND GETDATE()

UNION ALL

Select 2 as Sort,'Summary ( Quotation ) : ',sum(DocTotal), convert(varchar,  DATEADD(month, -1, GETDATE()),104)+' - '+convert(varchar,   GETDATE(),104) from OQUT where DocDate between  DATEADD(month, -1, GETDATE()) AND GETDATE()

UNION ALL

select 3 as Sort,cast(DocNum as varchar) as DocNum,DocTotal,convert(varchar, DocDate,104) from ORDR where DocDate between  DATEADD(month, -1, GETDATE()) AND GETDATE()

UNION ALL

Select 4 as Sort,'Summary ( Order ) : ',sum(DocTotal), convert(varchar,  DATEADD(month, -1, GETDATE()),104)+' - '+convert(varchar,   GETDATE(),104) from ORDR where DocDate between  DATEADD(month, -1, GETDATE()) AND GETDATE()

ORDER by Sort

regards,

Maik

Former Member
0 Kudos

Thank you Maik for this important guidance. I'll try to do what you said.

Pleas, may i ask one more question, Can i make two separate sql queries and display them in one grid?, i'm thinking of splitting the queries i need then order how to display them in grid, Is this doable?

Thanks in advance

maik_delly
Active Contributor
0 Kudos

Hi Karem,

what you are asking is mainly what I have shown above. You just have to make sure that you have one query ( including  nested queries ). Of course complex data need a complex query but this is fun of it.

If it's not possible to get all data with one query ( in my experience it is most of the time possible ) you still can fill the datatable row by row and if necessary you can also sort the gird programmatically.

regards,

Maik

Answers (0)