晶体报告中数量的第N次幂

时间:2013-08-30 07:12:04

标签: crystal-reports crystal-reports-2008

如何在水晶报告中找到数字的n次幂。

For E.g

For 2 to the power of 4 should return 16
2 to the power of 5 should return 32.

2 个答案:

答案 0 :(得分:0)

不知何故设法解决了我的问题,虽然解决方案很奇怪。发布以便任何人都可以使用。

Local stringVar array x:= ['c1','c2'];

Local NumberVar i;
Local NumberVar j:=1;

For i:=0 to (Count(x)) do
(
if(i=0) then
(
j:=2;
)
else
j:=(j*2)+(j*2);

i:=i+1;
);

Count(x);
if(Count(x)=1) then
(
j:=2;
)
else
j/2;

答案 1 :(得分:0)

插入符号(^)是您正在寻找的运算符。

示例:2 ^ 4计算结果为16,2 ^ 5计算结果为32