Crystal reports 在交叉表中包括公式字段

Crystal reports 在交叉表中包括公式字段,crystal-reports,crystal-reports-2008,Crystal Reports,Crystal Reports 2008,您好,我有一个很长的公式字段,我想将其作为交叉表报表摘要字段包括在内。但是,在定义公式字段后,我在交叉表屏幕中看不到它。如何包含它? 这是我的公式字段 WhilePrintingRecords; numberVar rt; numberVar layMdp; numberVar totMdp; rt=Round(({Command.GENGNPIAMT}/{Command.TOTALGNP})*100,2); layMdp:={Command.GENPREMMDP}; totMdp:=

您好,我有一个很长的公式字段,我想将其作为交叉表报表摘要字段包括在内。但是,在定义公式字段后,我在交叉表屏幕中看不到它。如何包含它? 这是我的公式字段

    WhilePrintingRecords;
numberVar rt;
numberVar layMdp;
numberVar totMdp;

rt=Round(({Command.GENGNPIAMT}/{Command.TOTALGNP})*100,2);
layMdp:={Command.GENPREMMDP};
totMdp:=(layMdp)*Truncate((rt/100),4);

另外,如果我把这个公式字段放在细节部分,它会显示一个零。为什么它什么都不算?我喜欢根据每个交叉表列计算值。

您正在设置变量,但公式本身没有返回任何内容。如果要返回totMdp的值,只需将其添加到最后一行之后:

WhilePrintingRecords;
numberVar rt;
numberVar layMdp;
numberVar totMdp;

rt=Round(({Command.GENGNPIAMT}/{Command.TOTALGNP})*100,2);
layMdp:={Command.GENPREMMDP};
totMdp:=(layMdp)*Truncate((rt/100),4);
totMdp