根据参数定义数据重复次数

【问题】
I design a report for printing item label.

I would like to duplicate each detail row with a report parameter that define how many time each Item repeating.

Example :

Value of report parameter (Qty of label by item) : 3

-label_item1

-label_item1

-label_item1

-label_item2

-label_item2

-label_item2

-label_item3

-label_item3

-label_item3

How can i achieve this ?

【回答】

先准备好数据,用 SPL 可以方便的复制每个细节行:

A
1 =connect(“demo”) 
2 =A1.query(“SELECT empname FROM STAFF”)
3 =A2.conj([~]*times)

运行结果:

A1:连接数据库

A2:查找数据

A3: 将数据复制 times 次,times 是参数,取大于零的整数