DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: wugangbest
今日帖子: 23
在线用户: 23
导航: 论坛 -> Web应用开发 斑竹:bodies  
作者:
男 bestfw (bestfw) ▲▲▲▲▲ -
普通会员
2022/5/1 23:09:59
标题:
请教一下unidbgrid汇总行只有一行,不够用,却不知怎么再最后多增加一行汇总行 浏览:1548
加入我的收藏
楼主: 请教一下unidbgrid汇总行只有一行,不够用,却不知怎么再最后多增加一行汇总行。研究了一下,感觉是被锁死的,确实不能添加。但是这应该是个最基本的功能吧,是不是有什么简单方法设置一下?
----------------------------------------------
-
作者:
男 zhyhero (zhyhero) ★☆☆☆☆ -
盒子活跃会员
2022/5/15 18:05:31
2楼: http://forums.unigui.com/index.php?/topic/15088-is-it-possible-to-make-dbgrid-summary-grand-total-multiline/#comment-82463

Is it possible to make DBGrid summary grand total multiline?

====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*====
Nadya(Posted September 15, 2020)
----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*----
Hello!

My DBGrid contains columns with positive and negative values.

I need to calculate 3 summary grand total values for every column - positive, negative and common summary (positive + negative).

For this separate calculation I use Column.AuxValues[1], Column.AuxValues[2] and Column.AuxValues[3] in OnColumnSummary and OnColumnSummaryTotal events.

OnColumnSummary:

    //positive
    if Column.Field.Value > 0
    then
      Column.AuxValues[1] := Column.AuxValues[1] + Column.Field.Value;
    //negative
    if Column.Field.Value < 0
    then
      Column.AuxValues[2] := Column.AuxValues[2] + Column.Field.Value;
    //total
    Column.AuxValues[3] := Column.AuxValues[1] + Column.AuxValues[2];
It works fine.

In OnColumnSummaryTotal event I would like to display this grand total values in 3 lines for every column:

    Result := FormatFloat('##0.00', Column.AuxValues[1]) + #13#10 +
    FormatFloat('##0.00', Column.AuxValues[2]) + #13#10 +
    FormatFloat('##0.00', Column.AuxValues[3]);
But it doesn't work, grand total row doesn't support text wrap and auto height. I can't place this values in 1 line because column will be too wide.

Is there any way to solve this problem or I should use additional components to display multi line grand total?

Thank you in advance for any advice!

====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*====
Sherzod(Posted September 15, 2020)
----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*----
Hello Nadya,

Try use '<br>' instead of #13#10

====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*====
Nadya(Posted September 15, 2020)
----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*----
Wonderful, that's exactly what is needed!!! Thank you VERY much!! :D

====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*====
Nadya(Posted September 15, 2020)
----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*----
And one more question about grand total summary - why OnColumnSummary and OnColumnSummaryTotal events doesn't work for text column?

I would like to place into grand total record (under text column "Name") this text: "Positive" + '<br>' + "Negative" + '<br>' + "Total"

But when I debug - this code doesn't work for my "Name" column

It's not allowed for text columns or maybe I've set some properties wrong?

Oh, if matters - my DBGrig has disabled Grouping

====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*====
Sherzod(Posted September 15, 2020)
----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*----
Is the issue resolved?

====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*====
Nadya          (Posted September 15, 2020)
----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*----
For numeric columns - it's all right (after replacing #13#10 by '<br>').

But for text column - no.

I would like to place into grand total (under string column "Name") this text: "Positive" + '<br>' + "Negative" + '<br>' + "Total"

But it doesn't work and when I debug - debugger doesn't enter the code fragment for "Name" column (string datatype).

OnColumnSummary and OnColumnSummaryTotal event are not allowed for text columns? Or maybe I've set some properties wrong?

====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*====
Nadya(Posted September 15, 2020)
----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*----
I'd like to make my grand total look like this:

Name..........Sum1........Sum2
-----*-----*-----*-----*-----*-----*-----
SomeText1....-100.........300
SomeText2.....200........-700
=====*=====*=====*=====*=====*=====*=====(grand total row)
Negative.....-100........-700
Positive......200.........300
Total.........100........-400
=====*=====*=====*=====*=====*=====*=====(grand total row)

====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*====
Nadya(Posted September 15, 2020)
----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*----
Ooops! I've found the reason - for column "Name" property ShowSummary = False was set.

Problem solved. Thanks for help!!!


====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*=====*====
Sherzod(Posted September 15, 2020)
----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*----
Yes.
----------------------------------------------
z@S7
作者:
男 zhyhero (zhyhero) ★☆☆☆☆ -
盒子活跃会员
2022/5/15 18:33:53
3楼: 文本编辑器太难用了

修改的时候居然没有UBB提示
[SHADOW=255,blue,1]"["和"]"符号好像会打破UBB标签[/SHADOW]
----------------------------------------------
z@S7
作者:
男 bestfw (bestfw) ▲▲▲▲▲ -
普通会员
2022/5/17 17:25:51
5楼: 非常感谢 zhyhero 就是这个问题。
----------------------------------------------
-
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行70.3125毫秒 RSS