找回密码
 立即注册

QQ登录

只需一步,快速开始

CasparGuo
超级版主   /  发表于:2022-8-23 15:28  /   查看:2166  /  回复:0
本帖最后由 James.Lv 于 2023-1-5 18:04 编辑

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

根据所设置的排序序号显示列的顺序
image.png946433410.png



好了下面是解密时间:


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


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

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

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


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

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


后附demo示例。


今天你学到了吗?




动态列排序demo.zip

392.03 KB, 下载次数: 312

0 个回复

您需要登录后才可以回帖 登录 | 立即注册
返回顶部