【问题】
两个问题:
1、Tamnguyen:
I have followed the instruction about FIRST function, and it works. But from my side, the data table look like this:
ID -- TagName -- TagValue 1 -- StringTag -- string1 1 -- StringTag -- string2 2 -- NumberTag -- 123 2 -- NumberTag -- 45
FIRST or LAST only display first or last TagValue, how can I achieve this in datacube:
ID -- StringTag -- NumberTag 1 -- string1, string2 -- 2 -- -- 123, 45
2、Sadaf Behbahani
I have the same problem as the last post and I would like to know is there any ways to have an out put like mentioned above?
Date -- Category – Icon 1 -- cat1 -- ic1 1 -- cat2 -- ic2
and in my cross tab i need to have something like this:
Date -- Category -- Icon 1 -- cat1,cat2 -- ic1,ic2
【回答】
To Tamnguyen:
交叉表控件没有这种汇总运算,不能直接使用这种源数据,可将源数据转为如下格式的 dataset,再用交叉表控件呈现:
ID | TagName | values |
1 | StringTag | string1,string2 |
2 | NumberTag | 123,45 |
用报表脚本描述不太方便,这里可以用 SPL 写一下:
A | |
1 | $select ID,TagName,TagValue from tb1 |
2 | =A1.group(ID,TagName; ~.(TagValue).concat@c():values) |
BIRT 可通过 jdbc 访问集算器,类似例子可参考【BIRT 调用 SPL 脚本】
To Sadaf Behbahani:
类似地,也可用 SPL 将源数据直接转为需要的二维表,再用 table 控件呈现:
A | |
1 | $select Date,Category,Icon from tb2 |
2 | =A1.group(Date; ~.(Category).concat@c():Cats,~.(Icon).string():Icons) |
这里的“~”表示分组后的每组记录,“(Category)”表示取字段形成的集合,函数 concat@c 可将集合成员拼为字符串,分隔符是逗号。