CasparGuo 发表于 2022-8-23 15:28:49

【报表-布局设计】报表的动态列排序

本帖最后由 James.Lv 于 2023-1-5 18:04 编辑

在Wyn中可以不仅可以实现报表的动态列,也可以对列进行排序,我们先来看一下效果:
选择每列的排序序号


根据所设置的排序序号显示列的顺序




好了下面是解密时间:


那么怎样能够完成这样一个动态列排序呢?


这里使用了强大的表达式的能力:

使用表达式swich来判断每个单元格显示的数据

依次类推,每一列都需要配置以上的公式来实现动态列的排序。

列头文本
{Switch(@订单编号排序 = "1" and "," & Join(@动态列, ",") & "," like "*,1,*", "订单编号", @支付方式排序 = "1" and "," & Join(@动态列, ",") & "," like "*,2,*", "支付方式", @订购日期排序 = "1" and "," & Join(@动态列, ",") & "," like "*,3,*", "订购日期", @购买数量排序 = "1" and "," & Join(@动态列, ",") & "," like "*,4,*", "购买数量")}
列的数据内容
{Switch(@订单编号排序 = "1" and "," & Join(@动态列, ",") & "," like "*,1,*", 订单编号, @支付方式排序 = "1" and "," & Join(@动态列, ",") & "," like "*,2,*", 支付方式, @订购日期排序 = "1" and "," & Join(@动态列, ",") & "," like "*,3,*", 订购日期, @购买数量排序 = "1" and "," & Join(@动态列, ",") & "," like "*,4,*", 购买数量)}

后附demo示例。


今天你学到了吗?




页: [1]
查看完整版本: 【报表-布局设计】报表的动态列排序