Crystal报表中的字符串数组中未显示的值

时间:2012-04-30 10:31:00

标签: crystal-reports

我在Crystal报告中有一个公式字段,如下所示

global numberVar detailLine ;
global stringVar array SummaryArun ;
WhilePrintingRecords ;
Redim Preserve SummaryArun [3] ;  

SummaryArun[1] :="Litres Of Liquid";
SummaryArun[2] :="Litres Of Alcohol";
SummaryArun[3] := "Percentage Strength";

我将此公式字段的输出作为“百分比强度”,但是当我声明另一个公式字段时,如下所示

global stringVar array SummaryArun ;
Redim Preserve SummaryArun [3] ;
SummaryArun[3];

我没有为这个领域做任何事情。

据我所知,我们需要将第二个公式字段值的值设为“百分比强度”。

如何在另一个公式字段中获取数组值?

1 个答案:

答案 0 :(得分:0)

更改您的第一个公式:

//{@formula_one}

// unless you are using this formula in the second pass (i.e. with summary fields)
// whileprintingrecords is unnecessary; it should always be the first entry if you are going
// to use it
WhilePrintingRecords ;

global numberVar detailLine ;

global stringVar array SummaryArun ;
// you don't need to add the Preserve option unless you are trying to keep existing values
// this doesn't appear to be the case here
Redim SummaryArun [3] ;

SummaryArun[1] := "Litres Of Liquid"; 
SummaryArun[2] := "Litres Of Alcohol"; 
SummaryArun[3] := "Percentage Strength";

更改第二个公式:

//{@Percentage Strength}

// if you are declaring your array WhilePrintingRecords (as you have done in the other formula)
// then you will need to do so when you *use* the variable
WhilePrintingRecords;

global stringVar array SummaryArun;

// you aren't changing the size of the array, so this line isn't necessary
//Redim Preserve SummaryArun [3] ;

SummaryArun[3];