0

我正在尝试创建代码以在 Excel 到 Word 邮件合并期间执行以下操作。

有以下数据:

ID  EV  DI  SE  PR
1   A   D   A   10
1   A   D   A   10
1   A   E   B   5
1   B   D   C   15
1   C   D   D   20
2   B   D   C   15
2   B   D   C   15
2   C   F   D   25
3   A   E   B   5
3   B   D   C   15
3   C   F   D   25
3   C   F   D   25

Where 
ID = Patron ID
EV = Event
DI = Discount
SE = Section
PR = Price

我需要将其合并如下,其中唯一顾客 ID 被归类为一条记录。

MERGEFIELD Patron ID
MERGEFIELD Event (where event name is A)
COUNT Discount WHERE Discount is D MERGEFIELD Discount MERGEFIELD Section @ MERGEFIELD Price
COUNT Discount WHERE Discount is E MERGEFIELD Discount MERGEFIELD Section @ MERGEFIELD Price
MERGEFIELD Event Name (where event name is B)

ETC

这将给出结果:

记录 1
1
A
2 DA @ 10
1 EB @ 5

B
1 DC @ 15

C
1 DD @ 20

下一条记录

记录 2
2
B
2 DC @ 15

C
1 FD @ 25

我找到了这段代码,但正在努力将其应用于这种情况,并且还想知道如何在自身内部使用它来突破事件。

{ IF { MERGESEQ } = "1" "{ MERGEFIELD CITY }¶
" "" }{ SET Place1 { MERGEFIELD CITY }}¶
{ If { Place2 } <> { Place1 }"¶
{ MERGEFIELD CITY }¶
¶
{ MERGEFIELD EMPLOYEE } { MERGEFIELD SALES }" "{ MERGEFIELD EMPLOYEE } { MERGEFIELD SALES }" }{ SET Place2 { MERGEFIELD CITY }}¶`" "" }{ SET Place1 { MERGEFIELD CITY }}¶

`

4

0 回答 0